Sunteți pe pagina 1din 198

UPC

UNIVERSITAT POLITÈCNICA DE CATALUNYA

DEPARTAMENT D’ENGINYERIA ELECTRÒNICA

IMPROVEMENTS IN DIRECT TORQUE CONTROL


OF INDUCTION MOTORS

Tesi doctoral presentada per a


l’obtenció del títol de doctor

Antoni Arias Pujol

Director: José Luis Romeral Martinez

Terrassa, Novembre 2000


INDEX.

Abstract AB.1
Index IN.1
Acknowledgements AC.1
Symbols S.1

Introduction
I.1 - Historical review I.1
I.2 - Structure of the thesis I.6
I.3 - Aims of the thesis I.8

Chapter 1 - Induction Motor Model. Generalities.


1.1 - Equations of the induction motor model 1.1
1.1.1 - Introduction 1.1
1.1.2 - Voltage equations 1.2
1.1.3 - Applying Park's transform 1.4
1.1.4 - Voltage matrix equations 1.5
1.1.4.1 - Fixed to the stator 1.5
1.1.4.2 - Fixed to the rotor 1.5
1.1.4.3 - Fixed to the synchronism 1.5
1.2 - Space phasor notation 1.6
1.2.1 - Introduction 1.6
1.2.2 - Current space phasors 1.7
1.2.3 - Flux linkage space phasor 1.9
1.2.3.1 - Stator flux-linkage space phasor in the stationary reference frame
fixed to the stator 1.9
1.2.3.2 - Rotor flux-linkage space phasor in the rotating reference frame
fixed to the rotor 1.10
1.2.3.3 - Rotor flux-linkage space phasor in the stationary reference frame
fixed to the stator 1.11
1.2.3.4 - Stator flux-linkage space phasor in the rotating reference frame
fixed to the rotor 1.12
1.2.4 - The space phasors of stator and rotor voltages 1.12
1.2.5 - Space-phasor form of the motor equations 1.13
1.2.5.1 - Space-phasor voltage equations in the general reference frame 1.13
1.2.5.2 - Space-phasor voltage equations in the stationary reference frame
fixed to the stator 1.14
1.2.5.3 - Space-phasor voltage equations in the rotating reference frame
fixed to the rotor 1.15
1.2.5.4 - Space-phasor voltage equations in the rotating reference frame at
synchronous speed 1.15
1.3 - Torque expressions 1.17

IN.1
Index.

1.3.1 - Introduction 1.17


1.3.2 - Deduction of the torque expression by means of energy considerations 1.17
1.3.3 - Torque constant 1.18
1.4 - Simulink model 1.19
1.4.1 - Equations used in the model 1.19
1.4.1.1 - Stator reference 1.19
1.4.1.2 - Rotor reference 1.19
1.4.1.3 - Synchronous reference 1.20
1.4.1.4 - Motion equation 1.20
1.4.2 - Simulated results 1.21
1.5 - Steady state analysis 1.23
1.5.1 - Steady state conditions 1.23
1.5.2 - Steady state equations 1.23
1.5.3 - Steady state equivalent circuit 1.24
1.6 - Interim conclusions 1.25

Chapter 2 - Direct Torque Control. Principles and Generalities.


2.1 - Induction motor controllers 2.1
2.1.1 - Voltage/frequency 2.1
2.1.2 - Vector controls 2.2
2.1.3 - Field Acceleration method 2.2
2.1.4 - Direct Torque Control 2.2
2.2 - Principles of Direct Torque Control 2.4
2.2.1 - Introduction 2.4
2.2.2 - DTC Controller 2.4
2.2.3 - DTC Schematic 2.7
2.2.3.1 - Stator flux and torque estimator using wm, isA and isB magnitudes 2.8
2.2.3.2 - Stator flux and torque estimator using Vdc, isA and isB magnitudes 2.9
2.2.4 - Parameter detuning effects 2.10
2.3 - Improvements in Direct Torque Control 2.11
2.3.1 - Introduction 2.11
2.3.2 - Different tables 2.11
2.3.2.1 - First approach 2.11
2.3.2.1.1 - Six sector table but different zones 2.11
2.3.2.1.2 - Twelve sector table 2.13
2.3.2.1.3 - Simulations, results and conclusions 2.15
2.3.2.2 - Second approach 2.18
2.3.2.3 - Third approach 2.19
2.3.2.4 - Conclusions 2.20
2.3.3 - Predictive methods 2.21
2.3.4 - Fuzzy logic based systems 2.22
2.3.5 - Regulating the flux 2.23
2.4 - Interim conclusions 2.25

IN.2
Index.

Chapter 3 - Fuzzy Logic Direct Torque Control.


3.1 - Introduction 3.1
3.2 - Fuzzy Logic Direct Torque Control 3.3
3.2.1 - Fuzzy Logic controller 1 3.3
3.2.1.1 - Objectives 3.3
3.2.1.2 - Inputs and output membership functions. 3.3
3.2.1.3 - Rules 3.5
3.2.2 - Fuzzy Logic controller 2 3.6
3.2.2.1 - Objectives 3.6
3.2.2.2 - Inputs and output membership functions. 3.6
3.2.2.3 - Rules 3.7
3.2.3 - Fuzzy Logic DTC schema 3.8
3.2.4 - Stator Flux Reference Optimum Controller 3.9
3.3 - Simulated results 3.10
3.4 - Interim conclusions 3.15

Chapter 4 - Design of Experimental Induction Motor Drive System.


4.1 - Introduction 4.1
4.2 - Induction motor drive architecture 4.3
4.3 - Implementing DTC and FLDTC 4.8
4.3.1 - Task distribution 4.8
4.3.2 - Programming the system 4.8
4.3.3 - Timing of the real implementation 4.9
4.4 - Simulation of the real plant 4.11
4.5 - Interim conclusions 4.14

Chapter 5 - Experimental Results.


5.1 - Corroborating the real implementation 5.1
5.1.1 - Classical DTC 5.1
5.1.2 - Fuzzy Logic DTC 5.8
5.2 - FLDTC and DTC comparison 5.10
5.3 - Interim conclusions 5.16

Chapter 6 - Conclusions. Further work.


6.1 - Conclusions 6.1
6.1.1 - Direct Torque Control 6.1
6.1.2 - Fuzzy Logic Direct Torque Control 6.2
6.1.3 - Experimental motor drive system 6.3
6.1.4 - Real implementation 6.4
6.2 - Further work 6.5

IN.3
Index.

References. R.1

Appendixes.
A.1 - Programs A.1
A.1.1 - TH1_5c.c A.2
A.1.2 - PCTH1_5c.c A.22
A.1.3 - TH1_9.c A.29
A.1.4 - PCTH1_9.c A.55
A.2 - Fuzzy rules A.65
A.2.1 - FLC 1 A.65
A.2.1.1 - Flux increase, Wpc < Tpc A.66
A.2.1.2 - Flux increase, Wpc > Tpc A.67
A.2.1.3 - Flux decrease, Wpc < Tpc A.68
A.2.1.4 - Flux decrease, Wpc > Tpc A.69
A.2.2 - FLC 2 A.70
A.3 - Experimental motor drive pictures A.71
A.3.1 - Workbench. Induction motor_1.5kW. DC motor A.71
A.3.2 - Resistors A.73
A.3.3 - Voltage Source Inverter A.75
A.3.4 - Workstation A.75

IN.4
ACKNOWLEDGEMENTS.

I am most grateful to my Director of Studies Dr. José Luis Romeral for his continuous help,
guidance, support and advice throughout the period of research to which this thesis relates.

I also like to thank Dr. Marcel Jayne for his support and advice especially during my stay in
the University of Glamorgan, and also for initiating and maintaining the collaboration
between the University of Glamorgan and the "Universitat Politècnica de Catalunya".

I would also like to acknowledge "Departament d'Enginyeria Electrònica" staff for providing
enjoyable and educational atmosphere.

Also, I would like to thank the economic support received from the "Comisión
Interministerial de Ciencia y Tecnología de España", CICYT, for realising this work, under
the TIC98-1092 Project.

Last but not least, I like to thank my parents and my sister for their patience and support.
Also, I like to thank Anna for her encouragement and comprehension especially during my
stay in the University of Glamorgan.

AC.1
SYMBOLS.

a 120º operator.
iri(t) Rotor current per phase.
ir Space phasor of the rotor current expressed in the rotor reference frame.
'
ir Space phasor of the rotor current expressed in the stator reference frame.
isi(t) Stator current per phase.
is Space phasor of the stator current expressed in the stator reference frame.
'
is Space phasor of the stator current expressed in the rotor reference frame.
Lm Three phase magnetising inductance.
Lr Total three phase rotor inductance.
Lr Rotor self-inductance.
Lr1 Leakage rotor inductance.
Lrm Rotor magnetising inductance.
Ls Total three phase stator inductance.
Ls Stator self-inductance.
Lsm Stator magnetising inductance.
Ls1 Leakage stator inductance.
Mr Mutual inductance between rotor windings.
Ms Mutual inductance between stator windings.
M sr Maximal value of the stator- rotor mutual inductance.
p Derivation operator.
P Pair of poles.
Rr Rotor Resistance.
Rs Stator Resistance.
s Slip.
1/s Integration operator.
Te Instantaneous value of the electromagnetic torque.
Tpc Instant torque referred to the nominal torque and in percentage.
Ts = Tz Sampling time.
uri(t) Rotor voltage per phase.
ur Space phasor of the rotor voltage expressed in the rotor reference frame.

ur
' Space phasor of the rotor voltage expressed in the stator reference frame.
usi(t) Stator voltage per phase.
us Space phasor of the stator voltage expressed in the stator reference frame.

us
' Space phasor of the stator voltage expressed in the rotor reference frame.
wm Mechanical speed.
wpc Instant torque referred to the nominal torque and in percentage.
wr Rotor pulsation.
ws Stator pulsation.

S.1
Symbols.

ρr Phase angle of the rotor flux linkage space phasor with respect to the direct-axis
of the stator reference frame.
ρs Phase angle of the stator flux linkage space phasor with respect to the direct-axis
of the stator reference frame.
θm Stator to rotor angle.
θr Rotor angle.
θs Stator angle.
Ψri(t) Flux linkage per rotor winding.
ψr Space phasor of the rotor flux linkage expressed in the rotor reference frame.

ψr
' Space phasor of the rotor flux linkage expressed in the stator reference frame.
Ψsi(t) Flux linkage per stator winding.
ψs Space phasor of the stator flux linkage expressed in the stator reference frame.
'
ψs Space phasor of the stator flux linkage expressed in the rotor reference frame.

Subscripts.

α/β Direct- and quadrature-axis components in the rotor reference frame.


d/q Rotor direct- and quadrature-axis components in the stator reference frame.
D/Q Stator direct and quadrature-axis components in the stator reference frame.
g General reference frame.
m Magnetizing.
r Rotor.
ra, rb, rc Rotor phases.
Ref Reference.
s Stator.
sA, sB, sC Stator phases.
x/y Direct- and quadrature-axis components in general reference frame or in
special reference frames.

Mathematical symbols.

x Cross vector product.


* Complex conjugate.

S.2
INTRODUCTION.

I.1 - Historical review.

The history of electrical motors goes back as far as 1820, when Hans Christian Oersted
discovered the magnetic effect of an electric current. One year later, Michael Faraday
discovered the electromagnetic rotation and built the first primitive D.C. motor. Faraday went
on to discover electromagnetic induction in 1831, but it was not until 1883 that Tesla invented
the A.C asynchronous motor [MAR 1].
Currently, the main types of electric motors are still the same, DC, AC asynchronous and
synchronous, all based on Oersted, Faraday and Tesla's theories developed and discovered
more than a hundred years ago.

I.1
Introduction.

Since its invention, the AC asynchronous motor, also named induction motor, has become the
most widespread electrical motor in use today.
At present, 67% of all the electrical energy generated in the UK is converted to
mechanical energy for utilisation. In Europe the electrical drives business is worth
approximately $1.0 Billion/ Annum.
These facts are due to the induction motors advantages over the rest of motors. The main
advantage is that induction motors do not require an electrical connection between stationary
and rotating parts of the motor. Therefore, they do not need any mechanical commutator
(brushes), leading to the fact that they are maintenance free motors. Induction motors also
have low weight and inertia, high efficiency and a high overload capability. Therefore, they
are cheaper and more robust, and less prove to any failure at high speeds. Furthermore, the
motor can work in explosive environments because no sparks are produced.
Taking into account all the advantages outlined above, induction motors must be considered
the perfect electrical to mechanical energy converter. However, mechanical energy is more
than often required at variable speeds, where the speed control system is not a trivial matter.

The only effective way of producing an infinitely variable induction motor speed drive is to
supply the induction motor with three phase voltages of variable frequency and variable
amplitude. A variable frequency is required because the rotor speed depends on the speed of
the rotating magnetic field provided by the stator. A variable voltage is required because the
motor impedance reduces at low frequencies and consequently the current has to be limited by
means of reducing the supply voltages [VAS 1] [MOH 1].

Before the days of power electronics, a limited speed control of induction motor was achieved
by switching the three-stator windings from delta connection to star connection, allowing the
voltage at the motor windings to be reduced. Induction motors are also available with more
than three stator windings to allow a change of the number of pole pairs. However, a motor
with several windings is more expensive because more than three connections to the motor
are needed and only certain discrete speeds are available. Another alternative method of speed
control can be realised by means of a wound rotor induction motor, where the rotor winding
ends are brought out to slip rings. However, this method obviously removes most of the

I.2
Introduction.

advantages of induction motors and it also introduces additional losses. By connecting


resistors or reactances in series with the stator windings of the induction motors, poor
performance is achieved.

At that time the above described methods were the only ones available to control the speed of
induction motors, whereas infinitely variable speed drives with good performances for DC
motors already existed. These drives not only permitted the operation in four quadrants but
also covered a wide power range. Moreover, they had a good efficiency, and with a suitable
control even a good dynamic response. However, its main drawback was the compulsory
requirement of brushes [MAR 1] [MOH 1].

With the enormous advances made in semiconductor technology during the last 20 years, the
required conditions for developing a proper induction motor drive are present. These
conditions can be divided mainly in two groups:
§ The decreasing cost and improved performance in power electronic switching devices.
§ The possibility of implementing complex algorithms in the new microprocessors.
However, one precondition had to be made, which was the development of suitable methods
to control the speed of induction motors, because in contrast to its mechanical simplicity their
complexity regarding their mathematical structure (multivariable and non-linear) is not a
trivial matter.

It is in this field, that considerable research effort is devoted. The aim being to find even
simpler methods of speed control for induction machines. One method, which is popular at
the moment, is Direct Torque Control [VAS 2].

Historically, several general controllers has been developed:


§ Scalar controllers: Despite the fact that "Voltage-Frequency" (V/f) is the simplest
controller, it is the most widespread, being in the majority of the industrial applications. It
is known as a scalar control and acts by imposing a constant relation between voltage and
frequency. The structure is very simple and it is normally used without speed feedback.
However, this controller doesn’t achieve a good accuracy in both speed and torque

I.3
Introduction.

responses, mainly due to the fact that the stator flux and the torque are not directly
controlled. Even though, as long as the parameters are identified, the accuracy in the speed
can be 2% (except in a very low speed), and the dynamic response can be approximately
around 50ms [LEO 1] [LUD 2].
§ Vector Controllers: In these types of controllers, there are control loops for
controlling both the torque and the flux [BOS 1]. The most widespread controllers
of this type are the ones that use vector transform such as either Park or Ku. Its
accuracy can reach values such as 0.5% regarding the speed and 2% regarding the
torque, even when at stand still. The main disadvantages are the huge
computational capability required and the compulsory good identification of the
motor parameters [ROM 1] .
§ Field Acceleration method: This method is based on maintaining the amplitude
and the phase of the stator current constant, whilst avoiding electromagnetic
transients. Therefore, the equations used can be simplified saving the vector
transformation, which occurs in vector controllers. This technique has achieved
some computational reduction, thus overcoming the main problem with vector
controllers and allowing this method to become an important alternative to vector
controllers [BED 5] [ROM 1] [YAM 1].

Direct Torque Control (DTC) has emerged over the last decade to become one possible
alternative to the well-known Vector Control of Induction Machines. Its main characteristic is
the good performance, obtaining results as good as the classical vector control but with
several advantages based on its simpler structure and control diagram.
DTC is said to be one of the future ways of controlling the induction machine in four
quadrants [LUD 1] [VAS 2]. In DTC it is possible to control directly the stator flux and the
torque by selecting the appropriate inverter state. This method still requires further
research in order to improve the motor’s performance, as well as achieve a better
behaviour regarding environmental compatibility (Electro Magnetic Interference and
energy), that is desired nowadays for all industrial applications.

I.4
Introduction.

DTC main features are as follows:


§ Direct control of flux and torque.
§ Indirect control of stator currents and voltages.
§ Approximately sinusoidal stator fluxes and stator currents.
§ High dynamic performance even at stand still.

The main advantages of DTC are:


§ Absence of co-ordinate transform.
§ Absence of voltage modulator block, as well as other controllers such as PID for
motor flux and torque.
§ Minimal torque response time, even better than the vector controllers.

However, some disadvantages are also present such as:


§ Possible problems during starting.
§ Requirement of torque and flux estimators, implying the consequent parameters
identification.
§ Inherent torque and stator flux ripple.

I.5
Introduction.

I.2 - Structure of the thesis.

The work presented in this thesis is organised in six main chapters. Theses six chapters are
structured as follows.

Chapter 1 is entitled " Induction Motor Model. Generalities.". It introduces a mathematical


model of cage rotor induction motors. Different ways of implementing these models are
presented as well as some simulations corroborating its validity. It must be said that all
simulations are obtained from MATLAB/Simulink. The elements of space phasor notation are
also introduced and used to develop a compact notation.

Chapter 2 is entitled " Direct Torque Control. Principles and Generalities.". It is devoted to
introduce different Direct Torque Control (DTC) strategies. However, firstly it is summarised
different induction motor controllers, such as the very well known vector control and "V/f".
Once DTC is placed in this general classification, it is fully and deeply described. Finally,
different methods for improving the main DTC drawbacks are introduced and studied. These
methods are classified as follows:
§ Different look up tables.
§ Predictive methods.
§ Fuzzy logic based systems.
Moreover, a method for regulating the stator flux to its optimum value it is presented.

Chapter 3 is entitled " Fuzzy Direct Torque Control". It covers a full and deep description of a
Fuzzy Logic Direct Torque Controller (FLDTC) which improves its performance. At the end
of the chapter simulated results are presented, which compare the classical DTC with FLDTC.

Chapter 4 is entitled " Design of Experimental Induction Motor Drive System". This chapter
describes the designed workbench drive. Real simulations of DTC and FLDTC are presented
taking into account all the non ideal behaviour and delays of the real drive. A way to
overcome the mentioned limitations is presented.

I.6
Introduction.

Chapter 5 is named " Experimental Results". This chapter is focused on the real
implementation of the classical DTC and FLDTC. Experimental results corroborate the
correct behaviour of both controllers. An experimental comparison between both controllers
is shown. Obviously, all experimental results obtained are from the workbench described in
chapter 4.

In Chapter 6, entitled "Conclusions", all achievements are summarised and appropriate


conclusions are drawn.

Finally, all PC/DSP programs used in the real implementation are listed in the appendixes.
Rules used in the Fuzzy Controllers are also listed. Also, some pictures of the workbench are
shown in the appendixes.

I.7
Introduction.

I.3 - Aims of the thesis.

The present thesis deals with the development of a Fuzzy Logic Direct Torque Controller that
has improved performance compared to the classical DTC system. The main improvement
has been the torque ripple reduction. Also, a stator flux optimum controller allows the FLDTC
to consume the right energy from the mains, keeping the power consumption to a minimum,
when again compared to the classical DTC system.
This new FLDTC system is firstly designed and proved by means of simulations. Later in the
thesis, experimental implementation is discussed and the results are presented.
Therefore, the development of this novel induction motor controller can be separated into the
following steps:
§ Point out the DTC disadvantages. Study the possible ways to overcome them, choosing
the best one (Fuzzy Logic).
§ Develop and mathematically describe the chosen Fuzzy Logic system. Corroboration of
its proper performance by means of simulation.
§ Development of a suitable "research workbench drive". Implementation of the FLDTC to
prove its proper functionality.

I.8
CHAPTER 1.
INDUCTION MOTOR MODEL. GENERALITIES.

1.1 - Equations of the induction motor model.

1.1.1 – Introduction.
A dynamic model of the machine subjected to control must be known in order to understand
and design vector controlled drives. Due to the fact that every good control has to face any
possible change of the plant, it could be said that the dynamic model of the machine could be
just a good approximation of the real plant. Nevertheless, the model should incorporate all the
important dynamic effects occurring during both steady-state and transient operations.
Furthermore, it should be valid for any changes in the inverter’s supply such as voltages or
currents [ROM 1].
Such a model can be obtained by means of either the space vector phasor theory or two-axis
theory of electrical machines. Despite the compactness and the simplicity of the space phasor
theory, both methods are actually close and both methods will be explained.
1.1
Induction motor model. Generalities.

For simplicity, the induction motor considered will have the following assumptions:
§ Symmetrical two-pole, three phases windings.
§ The slotting effects are neglected.
§ The permeability of the iron parts is infinite.
§ The flux density is radial in the air gap.
§ Iron losses are neglected.
§ The stator and the rotor windings are simplified as a single, multi-turn full pitch coil
situated on the two sides of the air gap.

sA'

sB
sC
ra'
rb

rc

rc'

rb'
ra
sC'
sB'

sA

Figure 1.1. Cross-section of an elementary symmetrical three-phase machine.

1.1.2 – Voltage equations.


The stator voltages will be formulated in this section from the motor natural frame, which is
the stationary reference frame fixed to the stator. In a similar way, the rotor voltages will be
formulated to the rotating frame fixed to the rotor.
In the stationary reference frame, the equations can be expressed as follows:
dψ sA (t) (1.1)
u sA (t) = R s i sA (t) +
dt
d ψ sB (t) (1.2)
u sB (t) = R s i sB (t) +
dt
dψ sC (t) (1.3)
u sC (t) = R s i sC (t) +
dt

1.2
Induction motor model. Generalities.

Similar expressions can be obtained for the rotor:


dψ ra (t) (1.4)
u ra (t) = R r i ra (t) +
dt
d ψ rb (t) (1.5)
u rb (t) = R r i rb (t) +
dt
dψ rc (t) (1.6)
u rc (t) = R r i rc (t) +
dt

The instantaneous stator flux linkage values per phase can be expressed as:
ψ sA = Ls i sA + M s isB + M s isC + M srcosθm i ra + M srcos(θm + 2 π 3 )irb + M srcos(θm + 4 π 3 )i rc (1.7)

ψ sB = M s i sA + L s i sB + M s i sC + M sr cos(θ m + 4 π 3 )i ra + M sr cosθ m i rb + M sr cos(θ m + 2 π 3 )i rc (1.8)

ψ sC = M s i sA + M s i sB + L s i sC + M sr cos(θ m + 2 π 3 )i ra + M sr cos(θ m + 4 π 3 )i rb + M sr cos θ m i rc (1.9)

In a similar way, the rotor flux linkages can be expressed as follows:


ψ ra = M srcos(- θ m )i sA + M srcos(- θ m + 2 π 3 )isB + M srcos(- θ m + 4 π 3 )isC + L ri ra + M r irb + M r irc (1.10)

ψ rb = M sr cos(- θ m + 4 π 3 )i sA + M sr cos(- θ m )i sB + M sr cos(- θ m + 2 π 3 )i sC + M r i ra + L r i rb + M r i rc (1.11)

ψ rc = M sr cos(- θ m + 2 π 3 )i sA + M sr cos(− θ m + 4 π 3 )i sB + M sr cos(- θ m )i sC + M r i ra + L r i rb + M r i rc (1.12)

Taking into account all the previous equations, and using the matrix notation in order to
compact all the expressions, the following expression is obtained:

u sA   R s + pL s pM s pM s p M sr cosθ m pM sr cosθ m1 pM sr cosθ m2  i sA 


u     
 sB   pM s R s + p Ls pM s p M sr cosθ m2 p M sr cosθ m p M sr cosθ m1  i sB 
 u sC   pM s pM s R s + pL s p M sr cosθ m1 p M sr cosθ m2 pM sr cosθ m  i sC 
 = ⋅  
 u ra   p M sr cosθ m pM sr cosθ m1 pM sr cosθ m2 R r + pL r pM r pM r   i ra 
 u rb   p M sr cosθ pM sr cosθ m p M sr cosθ m1 pM r R r + pL r pM r  i 
   m2   rb 
 u rc   p M sr cosθ m1 p M sr cosθ m2 p M sr cosθ m pM r pM r R r + p L r   i rc 

(1.13)

1.3
Induction motor model. Generalities.

1.1.3 – Applying Park’s transform.


In order to reduce the expressions of the induction motor equation voltages given in equation
1.1 to equation 1.6 and obtain constant coefficients in the differential equations, the Park’s
transform will be applied. Physically, it can be understood as transforming the three windings
of the induction motor to just two windings, as it is shown in figure 1.2 [VAS 1].

sQ

sB rβ

Wm
ra Wm rα

rb

sA sD

rc
sC

Figure 1.2 Schema of the equivalence physics transformation.

In the symmetrical three-phase machine, the direct- and the quadrature-axis stator magnitudes
are fictitious. The equivalencies for these direct (D) and quadrature (Q) magnitudes with the
magnitudes per phase are as follows:
u s 0   1 2 1 1
 u sA 
  
2 2
  
u sD  = c ⋅  cos θ cos (θ − 3 ) cos(θ + 3 )  ⋅  u sB 
2π 2π
(1.14)
u sQ 
  − sin θ − sin (θ − 2 π 3 ) − sin (θ + 2 π 3 )  u sC 

u sA  1 cos θ − sin θ   u s 0 
u  = c ⋅  1   
2

 sB   2
cos (θ − 2 π 3 ) − sin (θ − 2 π 3 ) ⋅ u sD  (1.15)
u sC  1
 2
cos (θ + 2 π 3 ) − sin (θ + 2 π 3 ) u sQ 

Where "c" is a constant that can take either the values 2/3 or 1 for the so-called non-power
2
invariant form or the value 3 for the power-invariant form as it is explained in section
1.3.3. These previous equations can be applied as well for any other magnitudes such as
currents and fluxes.
Notice how the expression 1.13 can be simplified into a much smaller expression in 1.16 by
means of applying the mentioned Park's transform.

1.4
Induction motor model. Generalities.

u sD   R s + pL s - L s pθ s pL m - L m ( P ⋅ w m + p θ r )  isD 
u     
 sQ  =  L s pθ s R s + pL s L m ( P ⋅ w m + pθ r ) pL m  ⋅  isQ 
 u rα   pL m - L m ( pθ s - P ⋅ w m ) R r + pL r - L r pθ r   i rα 
     
 rβ   L m ( p θ s - P ⋅ w m ) L r pθ r R r + pL r
(1.16)
u pL m   i rβ 

Where Ls = L s − M s , Lr = Lr − M r and Lm = 3
2 M sr .

1.1.4 – Voltage matrix equations.


If the matrix expression 1.16 is simplified, new matrixes are obtained as shown in equations
1.17, 1.18 and 1.19 [VAS 1].

1.1.4.1 – Fixed to the stator.


It means that ws = 0 and consequently wr = -wm.
u sD   R s + pL s 0 pLm 0  i sD 
u    
 sQ  =  0 R s + pLs 0 pL m  i sQ 

 u rd   pL m P ⋅ w m Lm R r + pL r P ⋅ w m L r   i rd 
      (1.17)
 u rq  - P ⋅ w m L m pL m - P ⋅ w m Lr R r + pL r   i rq 

1.1.4.2 – Fixed to the rotor.


It means that wr = 0 and consequently ws = wm.
u sD   R s + pLs - Ls P wm pL m − L m P w m   isD 
u    i 
 sQ  =  L s P w m R s + pL s L m P wm pLm  ⋅  sQ 
 u rd   pL m 0 R r + pL r 0   i rd 
      (1.18)
 u rq   0 pL m 0 R r + pL r   i rq 

1.1.4.3 – Fixed to the synchronism.


It means that wr = sws.
u sD   R s + pLs - Ls w s pL m − L m w s  i sD 
u    
 sQ  =  L s w s R s + pLs Lm w s pL m  i sQ 

 u rd   pL m − L m sw s R r + pL r − L r sw s   i rd 
      (1.19)
 u rq   L m sw s pL m L r sw s R r + pL r   i rq 

1.5
Induction motor model. Generalities.

1.2 – Space phasor notation.

1.2.1 – Introduction.
Space phasor notation allows the transformation of the natural instantaneous values of a three-
phase system onto a complex plane located in the cross section of the motor. In this plane, the
space phasor rotate with an angular speed equal to the angular frequency of the three phase
supply system. A space phasor rotating with the same angular speed, for example, can
describe the rotating magnetic field. Moreover, in the special case of the steady state, where
the supply voltage is sinusoidal and symmetric, the space phasor become equal to three-phase
voltage phasors, allowing the analysis in terms of complex algebra. It is shown in figure 1.3
the equivalent schematic for this new model.
Ws

sB

Wr
ra Wm r

rb

sA

rc
sC

Figure 1.3. On the right the equivalent two rotating windings induction motor.

In order to transform the induction motor model, in natural co-ordinates, into its equivalent
space phasor form, the 120º operator is introduced:
2π 4π
a = ej 3
, a2 = ej 3 (1.20)
Thus, the current stator space phasor can be expressed as follows:
[ ]
i s = c ⋅ 1 ⋅ i sA (t ) + a ⋅ i sB (t ) + a 2 ⋅ i sC (t ) (1.21)

The factor "c", takes usually one of two different values either 2
3 or 2
3 . The factor 2
3

makes the amplitude of any space phasor, which represents a three phase balanced system,
equal to the amplitudes of one phase of the three-phase system. The factor 2
3 may also be

used to define the power invariance of a three-phase system with its equivalent two-phase
system (see section 1.3.3).

1.6
Induction motor model. Generalities.

1.2.2 – Current space phasors.


During this section the induction machine assumptions introduced in the section 1.1.1 will be
further considered.
It is represented in figure 1.4 the model of the induction machine with two different frames,
the D-Q axis which represent the stationary frame fixed to the stator, and the α-β axis which
represent rotating frame fixed to the rotor.

sQ

sA'

sB α θ wm
sC
ra' rα
rb
θm
rc

rc' sD

rb'
ra
sC'
sB'

sA
Figure 1.4. Cross-section of an elementary symmetrical three-phase machine, with
two different frames, the D-Q axis which represent the stationary frame fixed to the
stator, and α-β axis which represent rotating frame fixed to the rotor.

The stator current space phasor can be expressed as follows:

is = 2
3
[i sA (t ) + aisB (t ) + a 2i sC (t )] = i s e jθ (1.22)

Expressed in the reference frame fixed to the stator, the real-axis of this reference frame is
denoted by sD and its imaginary-axis by sQ.
The equivalence between the stator phasor and the D-Q two-axis components is as follows:

i s = isD ( t ) + j ⋅ i sQ ( t ) (1.23)

or:

[ (i
Re( is ) = Re 2
3 sA ]
+ aisB + a 2 isC ) = i sD

Im (i ) = Im[ (i )] = i (1.24)
s
2
3 sA + aisB + a 2 isC sQ

1.7
Induction motor model. Generalities.

The relationship between the space phasor current and the real stator phase currents can be
expressed as follows:

[ (i + ai + a i )] = i
Re( is ) = Re 2
3 sA sB
2
sC sA

Re( a i ) = Re[ (a i + i + ai )] = i
2
s
2
3
2
sA sB sC sB

Re( ai ) = Re[ ( ai + a i + i )] = i 2
(1.25)
2
s 3 sA sB sC sC

In a similar way, the space phasor of the rotor current can be written as follows:

ir = 2
3 [i ra (t) + airb (t ) + a 2 irc (t )] = ir e jα (1.26)

Expressed in the reference frame fixed to the rotor, the real-axis of this reference frame is
denoted by rα and its imaginary-axis by rβ.
The space phasor of the rotor current expressed in the stationary reference frame fixed to the
stator can be expressed as follows:

i r = ir e jθ = ir e ( m )
' j α +θ (1.27)

The equivalence between the current rotor space phasor and the α-β two-axis is as follows:

ir = ir α ( t ) + j ⋅ irβ ( t ) (1.28)

or:

[ (i
Re( ir ) = Re 2
3 ra + airb + a 2 i rc ) = irα ]
Im (i ) = Im[ (i )] = i (1.29)
r
2
3 ra + airb + a 2 i rc rβ

The relationship between the space phasor current and the real stator currents can be
expressed as follows:

[ (i + ai + a i )] = i
Re( ir ) = Re 2
3 ra rb
2
rc ra

Re( a i ) = Re[ ( a i + i + ai )] = i
2
r
2
3
2
ra rb rc rb

Re( ai ) = Re[ (ai + a i + i )] = i


2 2
(1.30)
r 3 ra rb rc rc

The magnetising current space-phasor expressed in the stationary reference frame fixed to the
stator can be obtained as follows:

i m = i s + ( N re N se )ir ' (1.31)

1.8
Induction motor model. Generalities.

1.2.3 – Flux linkage space phasor.


In this section the flux linkages will be formulated in the stator phasor notation according to
different reference frames.

1.2.3.1- Stator flux-linkage space phasor in the stationary reference frame fixed to the stator.
Similarly to the definitions of the stator current and rotor current space phasors, it is possible
to define a space phasor for the flux linkage as follows:

ψs = 2
3 (ψ sA + aψ sB + a 2 ψ sC ) (1.32)

If the flux linkage equations 1.7, 1.8, 1.9 are substituted in equation 1.32, the space phasor for
the stator flux linkage can be expressed as follows:

( ) ( ) (
i L + a M s + a 2 M s + i M s + a L + a 2 M s + i M s + a M s + a 2 L + 
 sA s sB s sC s

)
ψs = 2
(
sr m sr ( m 3)
+ i M cos θ + a M cos θ + 4 π + a 2 M cos θ + 2 π +
 ra sr ( m 3) )


3 
(
+ irb M sr cos(θ m + 3 ) + a M sr cos θ m + a M sr cos( θ m + 3 ) +
2 π 2 4 π
)


 
(
+ irc M sr cos(θ m + 4 π 3 ) + a M sr cos( θ m + 2 π 3 ) + a M sr cos θ m
2
)

(1.33)

Developing the previous expression 1.33, it is obtained the following expression:

( ) ( ) (
i L + a M s + a 2 M s + a ⋅ i a 2 M s + L + a M s + a 2 i a M s + a 2 M s + L +
 sA s sB s sC s

)
2
ψs = 3 
ra sr( m sr ( m 3)
 + i M cos θ + a M cos θ + 4 π + a 2 M cos θ + 2 π +
sr ( m 3) ) 

2
(
 + a ⋅ irb a M sr cos (θ m + 3 ) + M sr cos θ m + a M sr cos (θ m + 3 ) +
2 π 4 π

 )
 
2
(
 + a ⋅ irc a M sr cos( θ m + 4 π 3 ) + a M sr cos (θ m + 2 π 3 ) + M sr cos θ m
2
 ) (1.34)

And finally, expression 1.34 can be represented as follows:

( ) (
ψ s = L s + a M s + a 2 M s i s + M sr cos θ m + a M sr cos(θ m + 4 π 3 ) + a 2 M sr cos(θ m + 2 π 3 ) i r = )
= (L ) ( ) ( ) '
s . M sr i r e j θm = L s − M s i s + 15
− M s i s + 1.5 cos θ m M sr i r = L s − M s i s + 15 . M sr i r =

= Ls i s + L m i
' (1.35)
r

Where Ls is the total three-phase stator inductance and Lm is the so-called three-phase
magnetising inductance. Finally, the space phasor of the flux linkage in the stator depends on
two components, being the stator currents and the rotor currents.
Once more, the flux linkage magnitude can be expressed in two-axis as follows:

ψ s = ψ sD + jψ sQ (1.36)

1.9
Induction motor model. Generalities.

Where its direct component is equal to:


ψ sD = Ls isD + Lm ird (1.37)
And its quadrature component is expressed as:
ψ sQ = Ls i sQ + Lm i rq (1.38)

The relationship between the components ird and irα and irq and irβ may be introduced as
follows:
'
i r = ird + jirq = i r e j θm (1.39)

The compactness of the notation in the space phasor nomenclature compared to the two-axis
notation in 1.1. is noticeable.

1.2.3.2- Rotor flux-linkage space phasor in the rotating reference frame fixed to the rotor.
The rotor flux linkage space phasor, fixed to the rotor natural frame can be defined as follows:

ψr = 2
3 (ψ ra + aψ rb + a 2 ψ rc ) (1.40)

If the flux linkage equations 1.10, 1.11, 1.12 are substituted in equation 1.40, the space phasor
for the rotor flux linkage can be expressed as follows:

( ) ( ) (
i L + a M r + a 2 M r + i M r + a L + a 2 M r + i M r + a M r + a 2 L + 
 ra r sB r sc r

)
2
ψr = 3 
sA sr ( m sr ( m 3)
+ i M cos θ + a M cos θ + 2 π + a 2 M cos θ + 4 π +
sr ( m 3) 
 )
(
+ isB M sr cos( θ m + 3 ) + a M sr cos θ m + a M sr cos(θ m + 3 ) +
4 π 2 2 π

 )
 
(
+ isC M sr cos( θ m + 2 π 3 ) + a M sr cos(θ m + 4 π 3 ) + a M sr cos θ m
2
) (1.41)

By re-arranging the previous expression 1.41, it can be expressed as:

( ) ( ) (
i L + a M r + a 2 M r + a ⋅ i a 2 M r + L + a M r + a 2 i a M r + a 2 M r + L + 
 ra r rb r rc r

)
 sa
ψ r = 23 
(sr m sr ( m 3)
+ i M cos θ + a M cos θ + 2 π + a M cos θ + 4 π + 2
sr ( m 3) ) 

2
(
+ a ⋅ isb a M sr cos( θ m + 3 ) + M sr cos θ m + a M sr cos(θ m + 3 ) +
4 π 2 π
) 

 2 
(
+ a ⋅ i sc a M sr cos( θ m + 2 π 3 ) + a M sr cos( θ m + 4 π 3 ) + M sr cos θ m
2
) (1.42)

And finally:

( ) (
ψ r = Lr + a M r + a 2 M r i r + M sr cos θ m + a M sr cos(θ m + 2 π 3 ) + a 2 M sr cos(θ m + 4 π 3 ) i s =)
= (L ) ( ) ( )
. cos( − θ m ) M sr i s = Lr − M r ir + 1.5 M sr i s e− jθ m = Lr − M r i r + 1.5 M sr i s =
'
r − M r i r + 15
' (1.43)
= Lr i r + Lm i s

1.10
Induction motor model. Generalities.

Where Lr is the total three-phase rotor inductance and Lm is the so-called three-phase
'
magnetising inductance. i s is the stator current space phasor expressed in the frame fixed to
the rotor.
Once more the flux linkage magnitude can be expressed in the two-axis form as follows:

ψ r = ψ rα + jψ rβ (1.44)

Where its direct component is equal to:


ψ rα = Lr ir α + L m i sα (1.45)
And its quadrature component is expressed as:
ψ rβ = Lr ir β + Lm i sβ (1.46)

1.2.3.3- Rotor flux-linkage space phasor in the stationary reference frame fixed to the stator.
The rotor flux linkage can also be expressed in the stationary reference frame using the
previously introduced transformation ejθm, and can be written as:

ψ
'
r ( )
= ψ rd + jψ rq = ψ r e j θm = ψ r α + jψ rβ e jθ m (1.47)

The space phasor of the rotor flux linkage can be expressed according to the fixed co-
ordinates as follows:
' ' ' '
ψ r = Lr i r + Lm i s e j θm = Lr i r + Lm i s (1.48)

The relationship between the stator current referred to the stationary frame fixed to the stator
and the rotational frame fixed to the rotor is as follows:
'
i s = i s e j θm
'
i s e − jθ m = i s (1.49)
Where
i s = isD + ji sQ

i s = is α + jis β
' (1.50)

From figure 1.5, the following equivalencies can be deduced:

i s = is e jθ
(1.51)
i s = is e jα = is e j(θ − θ m ) = i s e− j θm
' ' '

1.11
Induction motor model. Generalities.

sQ

is,is'
wm


α θ
θm

sD
Figure 1.5. Stator-current space phasor expressed in accordance with the rotational
frame fixed to the rotor and the stationary frame fixed to the stator.

1.2.3.4- Stator flux-linkage space phasor in the rotating reference frame fixed to the rotor.
Similarly than 1.2.3.3 section, it can be deduced the following expression:

=  L s i s + L m i r  e m = Ls i s + L m i r
'
ψ s = ψ se
− jθ m ' − jθ ' (1.52)

1.2.4. – The space phasors of stator and rotor voltages.


The space phasors for the stator and rotor voltages can be defined in a similar way like the
one used for other magnitudes.

us = 2
3 [usA
( t ) + ausB ( t ) + a 2usC ( t ) ] = usD + jusQ = 2
3 (usA − 12 usB − 12 usC ) + j 1
3 (u sB − usC )
ur = 2
3 [ura
( t ) + aurb( t ) + a 2 urc ( t ) ] = urα + jurβ = 23 (ura − 12 urb − 12 urc ) + j 1
3
(u rb − urc ) (1.53)

Where the stator voltage space phasor is referred to the stator stationary frame and the rotor
voltage space phasor is referred to the rotating frame fixed to the rotor.
Provided the zero component is zero [VAS 1], it can also be said that:

usA = Re( u s )
usB = Re( a 2 u s )
usC = Re( aus )
(1.54)

Equivalent expressions can also be obtained for the rotor.

1.12
Induction motor model. Generalities.

1.2.5 - Space-phasor form of the motor equations.


The space phasor forms of the voltage equations of the three-phase and quadrature-phase
smooth air-gap machines will be presented. Firstly, the equations will be expressed in a
general rotating reference frame, which rotates at a general speed wg, and then to the
references frames fixed to the stator, rotor and synchronous speed.

1.2.5.1 - Space-phasor voltage equations in the general reference frame.


If the vector in the figure 1.6 is the stator current, then its formulation in the space phasor
form is as follows:
− j θg
i sg = i s e = i sx + ji sy (1.55)

sQ

y

wg

αr
αs wm
θg rα
θm
sD

Figure 1.6. It is shown a magnitude represented by means of the vector, and its angle
referred to the three different axis. The three different axis are: sD-sQ fixed to the
stator, rα-rβ fixed to the rotor whose speed is wm, and finally the general frame
represented by means of the axis x-y whose speed is equal to wg .

In a similar way and for other magnitudes, it can be written the following equations:
− jθ g
u sg = u s e = usx + jusy
− jθ g (1.56)
ψ sg = ψ s e = ψ sx + jψ sy

Where the magnitudes are the voltage space phasor and the stator flux linkage respectively.
However, if the magnitude in the figure 1.6 is for instance the rotor current, its space phasor
notation will be:

i rg = i r e
(
− j θ g −θ m ) = i + ji (1.57)
rx ry

1.13
Induction motor model. Generalities.

and for other magnitudes:

u rg = u r e
(
− j θ g −θ m ) = u rx + ju ry

ψ rg = ψ r e
(
− j θ g −θ m ) = ψ rx + jψ ry
(1.58)

Manipulating the previous equations yields the following stator and rotor space phasor
voltage equations in the general reference frame.

u sg e
j θg
= Rs i sg e
jθ g
+
(
d ψ sg e
jθ g
)=R i j θg
+e
jθ g d ψ sg
+ je
jθ g
w g ψ sg
s sg e
dt dt
d  ψ r e (
j θ g −θ m ) 
( ) = R i rg e ( )+   ( ) + e j( θ ) d ψ rg + je j ( θ ) w − P⋅ w ψ
( g m ) rg
j θ g −θ m j θ g −θ m j θ g − θm −θ m −θ m
u rg e r = Rr i rg e g g

dt dt

(1.59)
Simplifying equation 1.59, it is obtained equation 1.60.
d ψ sg
u sg = R s i sg + + jw g ψ sg
dt
(1.60)
d ψ rg
u rg = Rr i rg +
dt
(
+ j w g − P ⋅ wm ψ rg )
Where, the flux linkage space phasors are:

ψ sg = Ls i sg + Lm i rg
ψ rg = Lr i rg + Lm i sg (1.61)

Using the two-axis notation and the matrix form, the voltage equations can be represented by:

u sx   R s + pLs - w g Ls pL m - w g Lm   isx 
u   w g Ls R s + pLs w g Lm pLm   
 sy  =    isy 
u rx  
  
pL m (P ⋅ w m )
- w g Lm R r + pL r ( ⋅
)
P ⋅ w m - w g L r   i rx 
  
( ) (w )
(1.62)
u ry   w g - P ⋅ w m L m pLm g - P ⋅ w m Lr R r + pL r   i ry 

1.2.5.2 - Space-phasor voltage equations in the stationary reference frame fixed to the stator.
If wg = 0, the matrix expression obtained is 1.63, being equal to the expression 1.17.
u sD   R s + pL s 0 pLm  i sD 
0
u    
 sQ  =  0 R s + pLs 0 pL m  i sQ 

 u rd   pL m P ⋅ w m Lm R r + pL r P ⋅ w m L r   i rd 
      (1.63)
 u rq  - P ⋅ w m L m pL m - P ⋅ w m Lr R r + pL r   i rq 

The stator voltage space phasor can be expressed as follows:


dψ s (1.64)
u s = Rs i s +
dt

1.14
Induction motor model. Generalities.

The rotor voltage space phasor can be written as:

d  ψ r e − jθ m 
'

' '  
u r e − jθ m = Rr i r e − jθ m +
dt
'
' ' dψ r ' (1.65)
u r = Rr i r + − j ⋅ P ⋅ wm ψ r
dt

And the flux linkage space phasors can be expressed as follows


'
ψ s = Ls i s + L m i r
' '
ψ r = Lr i r + L m i s (1.66)

1.2.5.3 - Space-phasor voltage equations in the rotating reference frame fixed to the rotor.
If wg = wm, the matrix expression obtained is 1.67, being equal to the expression 1.18.
u sD   R s + pLs - Ls P wm pL m − L m P w m   isD 
u    i 
 sQ  =  L s P w m R s + pL s L m P wm pLm  ⋅  sQ 
 u rd   pL m 0 R r + pL r 0   i rd 
      (1.67)
 u rq   0 pL m 0 R r + pL r   i rq 

The stator voltage space phasor can be expressed as follows:

' ' dψs


'
'
(1.68)
us = Rs i s + + jψ s ⋅ P ⋅ wm
dt
The rotor voltage space phasor can be written as:
dψr (1.69)
u r = Rr i r +
dt

And the flux linkage space phasors can be expressed as follows


'
ψ s = Ls i s + L m ir
' (1.70)
'
ψ r = Lr ir + L m i s

1.2.5.4 - Space-phasor voltage equations in the rotating reference frame at synchronous speed.
If wg = ws, the matrix expression obtained is 1.71, being equal to expression 1.19.
u sD   R s + pLs - Ls w s pL m − L m w s  i sD 
u    
 sQ  =  L s w s R s + pLs Lm w s pL m  i sQ 

 u rd   pL m − L m sw s R r + pL r − L r sw s   i rd 
      (1.71)
 u rq   L m sw s pL m L r sw s R r + pL r   i rq 

1.15
Induction motor model. Generalities.

The stator voltage space phasor can be expressed as follows:


d ψ sg (1.72)
u sg = Rs i sg + + jψ sg w s
dt

The rotor voltage space phasor can be written as:


d ψ rg (1.73)
u rg = R r i rg + + j ψ rg ( w s − P ⋅ w m )
dt
And the flux linkage space phasors can be expressed as follows
ψ sg = Ls i sg + L m i rg (1.74)
ψ rg = L r i rg + L m i sg

1.16
Induction motor model. Generalities.

1.3 – Torque expressions.

1.3.1 - Introduction.
The general expression for the torque is as follows:
'
t e = cψ s × i r (1.75)

Where the “c” is a constant, ψ s and i r are the space phasors of the stator flux and rotor
'

current respectively, both referred to the stationary reference frame fixed to the stator.
The expression given above can also be expressed as follows:

t e = c ψ s ⋅ i r sin γ (1.76)

Where γ is the angle existing between the stator flux linkage and the rotor current. It follows
that when γ=90o the torque obtained is the maximum and its expression is exactly equal to the
one for the DC machines. Nevertheless, in DC machines the space distribution of both
magnitudes is fixed in space, thus producing the maximum torque for all different magnitude
values. Furthermore, both magnitudes can be controlled independently or separately. In an
AC machine, however, it is much more difficult to realise this principle because both
quantities are coupled and their position in space depends on both the stator and rotor
positions. It is a further complication that in squirrel-cage machines, it is not possible to
monitor the rotor current, unless the motor is specially prepared for this purpose in a special
laboratory. It is impossible to find them in a real application. The search for a simple control
scheme similar to the one for DC machines has led to the development of the so-called vector-
control schemes, where the point of obtaining two different currents, one for controlling the
flux and the other one for the rotor current, is achieved [VAS 1].

1.3.2 - Deduction of the torque expression by means of energy considerations.


Torque equation is being deduced by means of energy considerations. Therefore, the starting
equation is as follows:
Pmechanic = Pelectric − Ploss − Pfield (1.77)

1.17
Induction motor model. Generalities.

Substituting the previous powers for its values, the equation can be expressed as follows:

  d ψ s *   d ψ'r '*   



3
2
*
( )
t e ⋅ wr =  Re u s ⋅ i s − Rs is − Re
2


is
dt  
 '
( '*
)
+  Re ur ⋅ i r − Rr ir − Re 
' 2

 dt
i r   
  
(1.78)
 

Since in the stationary reference frame, the stator voltage space phasor u s can only be
balanced by the stator ohmic drop, plus the rate of change of the stator flux linkage, the
previous expression can be expressed as follows:

( ' '*
) ( ' '*
)
t e ⋅ wr = 32 Re − jwr ψ r i r = − 32 wr Re j ψ r i r = − 32 wr ψ r × i r
' ' (1.79)

Expressing the equation in a general way for any number of pair of poles gives:

t e = − 32 Pψ r × i r
' '
(1.80)

If equations 1.66 and 1.35 are substituted in equation 1.80, it is obtained the following
expression for the torque:

t e = 32 P ψ s × i s (1.81)

If the product is developed, expression 1.81 is as follows:


(
t e = 32 P ψsD ⋅ i sQ − ψ sQ ⋅ i sD ) (1.82)

Finally, different expressions for the torque can be obtained as follows:

t e = − 32 P L r i r + L m i s  × i r = − 32 PL m i s × i r = − 32 PL m i s × i r
' ' ' '

 
L 3L Lm
t e = − 32 P m  L m i r + L s i s  × i r = −P m ψ s × i r = − P
' ' ' 3 '
ψs × ψ r
Ls   2 Ls 2 LsLr − Lm 2 (1.83)

1.3.3 – Torque constant.


The value of the torque constant can take two different values. These depend on the constant
used in the space phasor. Both possibilities are shown in table I.I.

Non power invariant Power invariant


Torque constant 3 1
2
Space phasor 3→2 2→3 3→2 2→3
constant
2 1 2 2
3 3 3
Table I.I. Torque constant values.
"3→2" means the change from three axis to either two axis or space phasor notation,
and "2→3" either two axis or space phasor notation to three axis.

1.18
Induction motor model. Generalities.

1.4 – Simulink model.

1.4.1 - Equations used in the model.


The final expressions used in the implemented models are obtained from all the previously
introduced expressions.
All equations have been re-arranged in order to use the operator 1/s instead of the operator p
because the “Simulink” deals with the integrator better than with the derivation.

1.4.1.1 – Stator reference.


Stator and rotor fluxes can be expressed as follows:
ψ sD = 1
s (usD − Rs isD )
ψ sQ = 1
s (u sQ − Rs isQ )
ψ 'rd = 1s (u '
rd − Rr i' rd − P ⋅ w m ψ 'rq = ) (− R i
1
s r
'
rd − P ⋅ w m ψ 'rq )
ψ 'rq = 1s (u '
rq − Rr i' rq + P ⋅ w m ψ 'rd ) = (− R i
1
s r
'
rq + P ⋅ w m ψ 'rd ) (1.84)

Stator and rotor currents can be expressed as follows:


Lr L
i sD = ψ sD − ψ 'rd m
Lx Lx
L L
i sQ = ψ sQ r − ψ 'rq m
Lx Lx
L L
ird' = ψ 'rd s − ψ sD m
Lx Lx
L L
irq' = ψ 'rq s − ψ sQ m
Lx Lx
where Lx = Ls Lr − L2m (1.85)

1.4.1.2 - Rotor reference.


Stator and rotor fluxes can be expressed as follows:
ψ rd = 1
s (urd − Rrird ) = 0
ψ rq = 1
s (urq )
− Rr irq = 0

ψ'sd = 1
s (u'
sd − Rs i'sd + P ⋅ wm ψ 'sq )
ψ'sq = 1s (u'
sq − Rr i'sq − P ⋅ wm ψ 'sd ) (1.86)

1.19
Induction motor model. Generalities.

Stator and rotor currents can be expressed as follows:


Lr Lm
isD = ψ ' sD − ψ 'rd
Lx Lx
Lr L
isQ = ψ ' sQ − ψ 'rq m
Lx Lx
Ls Lm
ird = ψ rd − ψ ' sD
Lx Lx
Ls L
irq = ψ rq − ψ ' sQ m
Lx Lx (1.87)
where L x = Ls Lr − L2m

1.4.1.3 - Synchronous reference.


Stator and rotor fluxes can be expressed as follows:

(
ψ sx = 1s usx − Rs isx + ws ψ sy )
ψ sy = 1s (u sy − Rr isy − ws ψ sx )
ψ rx = 1
s (u rx ) (
− Rr irx + ψ ry ( ws − P ⋅ wm ) = 1s − Rr irx + ψ ry ( ws − P ⋅ wm ) )
ψ ry = 1
s (u ry − Rr iry − ψ rx (w − P ⋅ w )) = ( − R i
s m
1
s r ry − ψ rx ( ws − P ⋅ wm )) (1.88)

Stator and rotor currents can be expressed as follows:


Lr L
isx = ψ sx − ψ rx m
Lx Lx
Lr L
isy = ψ sy − ψ ry m
Lx Lx
Ls Lm
irx = ψ rx −ψ sx
Lx Lx
Ls Lm
iry = ψ ry −ψ sy
Lx Lx (1.89)
where Lx = Ls Lr − L2m

1.4.1.4 – Motion equation.


The motion equation is as follows:
dw m (1.90)
te − tL = J + Dw m
dt
Where, te is the electromagnetic torque, tL is load torque, J is the inertia of the rotor, and
finally the D is the damping constant.

1.20
Induction motor model. Generalities.

Using the torque expressions 1.82, the previous motion equation can be expressed as follows:
P ⋅ c ⋅ (ψ sD ⋅ i sQ − ψ sQ ⋅ i sD ) = t L + w m (D + Js)
P ⋅ c ⋅ (ψ sD ⋅ i sQ − ψ sQ ⋅ i sD ) − t L
wr =
D + Js
(1.91)
Where P is the number of pair of poles and the torque constant take the values either 1 or 2/3
according to the table I.I shown in the previous section 1.3.3.

1.4.2 – Simulated results.


Figures 1.7 and 1.8 show the torque and speed responses obtained from equation 1.84 to
equation 1.91. It must be said that all three different references (stator, rotor and synchronous)
gave the same simulated results shown in figures 1.7 and 1.8. The validity of the motor model
is corroborated.
All simulations are done in Matlab/Simulink. Motor characteristics are listed in section 4.2.

60 60

50 50

40 40
torque (Nm)

torque (Nm)

30 30

20 20

10 10

0 0

-10 -10
0 0.2 0.4 0.6 0.8 1 1.2 0 0.2 0.4 0.6 0.8 1 1.2

time (s) time (s)

Figure 1.7. Torque response without load. Left: Motor_1kW. Right: Motor_1.5kW.
Te= 0Nm, J=0.08Kgm2. Notice the transient at the beginning and the steady state
torque value, being 0Nm for this ideal case.

1.21
Induction motor model. Generalities.

160 160

140 140

120 120

100 100
wm (rd/s)

wm (rd/s)
80 80

60 60

40 40

20 20

0 0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 0 0.2 0.4 0.6 0.8 1 1.2 1.4

time (s) time (s)

Figure 1.8. Speed response without load. Left: Motor_1kW. Right: Motor_1.5kW.
Te=0Nm, J=0.08Kgm2. Notice the small ripple at the beginning due to the transient.
The final speed value is 157 rd/s, as expected from this ideal case, where Te=0Nm.

1.22
Induction motor model. Generalities.

1.5 – Steady state analysis.

1.5.1 - Steady state conditions.


This section deals with the conditions under which, induction motor operates in steady state.
When an induction motor operates in steady state and is supplied by symmetrical and
sinusoidal waveforms, the space vectors become identical to its phasors. Therefore, the
following assumptions expressed in 1.92, can be taken into account:

u s = Vs
'
u r = Vr' e j θ
d is
= jws I s
dt
'
d ir
= jwr I r' + j ⋅ P ⋅ wm I r' (1.92)
dt

1.5.2 - Steady state equations.


From the expressions 1.64, 1.65 and 1.66, referred to the stationary reference frame fixed to
the stator, can be written the equations 1.93 for the stator and 1.94 for the rotor, valid in both
transient and steady state:
'
dis 3 dir
u s = R s i s + (L s1 + 3 2 Lsm ) + 2 Lrm
dt dt (1.93)
'

− j ⋅ P ⋅ wm  (Lr 1 + 3 2 L rm )i r + 3 2 Lsm i s 
dir 3 dis
u = R i + (Lr 1 + 2 L rm )
' ' '
r r r
3 + 2 L sm
dt dt   (1.94)
Once the conditions described above in equations 1.92 are applied to the stator 1.93 and rotor
1.94 equations, stator 1.95 and rotor 1.96 steady state equations are obtained:

V s = Rs I s + jws (L s1 + 3 2 L sm )I s + jws 3
2 Lsm I r' (1.95)

0 = R r s I r' + jws (Lr 1 + 3


2 L sm )I r' + jws 3
2 Lsm I s (1.96)

1.23
Induction motor model. Generalities.

1.5.3 - Steady state equivalent circuit.


From the equations 1.95 and 1.96, the well-known equivalent circuit for an induction motor
can be drawn as shown in figure 1.9:
Rs wsL s1 wsL r1 Rr/s

Is 3/2wsLsm Ir'

Figure 1.9. Steady state equivalent circuit of Induction motor.

From the previous steady state induction motor model the following expressions for the
torque, stator current and stator flux can be obtained:

T = 3 P 2 Rr s 1 I r'
2 (1.97)
ws

Rr
+ jws (Lr 1 + 3 2 Lsm ) '
Is = s
Ir
− jws 3 2 L sm (1.98)
ψ s = (L s1 + 3 2 Lsm )I s + 3 2 Lsm I r' (1.99)

1.24
Induction motor model. Generalities.

1.6 – Interim conclusions.

In the present chapter has been deduced the motor model. The model has been formulated by
means of the two-axis theory equations and the space phasor notation. Despite the fact that
both nomenclatures are valid, it has been proved that the space phasor notation is much more
compact and easier to work with. The model has been developed in both nomenclatures for
the stator, rotor and synchronous references. In further chapters, the motor model with stator
reference, introduced in section 1.4.1.1, will be the one most used.
Different torque expressions have been deduced.
The final concrete equations used in the Matlab/Simulink motor model have been presented
by the three different references. Some simulations are shown to prove the validity of the
model, being equal for the previously mentioned three references. Two different motors have
been used in the model.
Finally the steady state motor analysis has been introduced.

1.25
CHAPTER 2.
DIRECT TORQUE CONTROL.
PRINCIPLES and GENERALITIES.

2.1 - Induction motor controllers.

2.1.1 – Voltage/frequency.
There are many different ways to drive an induction motor. The main differences
between them are the motor’s performance and the viability and cost in its real
implementation.
Despite the fact that "Voltage/frequency" (V/f) is the simplest controller, it is the
most widespread, being in the majority of the industrial applications. It is known as a
scalar control and acts imposing a constant relation between voltage and frequency.
The structure is very simple and it is normally used without speed feedback.
However, this controller doesn't achieve a good accuracy in both speed and torque

2.1
Direct Torque Control. Principles and Generalities.

responses mainly due to the fact that the stator flux and the torque are not directly
controlled. Even though, as long as the parameters are identified, the accuracy in the
speed can be 2% (except in a very low speed) and the dynamic response can be
approximately around 50ms [LEO 1][LUD 2].

2.1.2 – Vector controls.


In these types of controllers, there are control loops for controlling both the torque
and the flux [BOS 1]. The most widespread controllers are the ones that use vector
transform such as either Park or Ku. Its accuracy can reach values such as 0.5%
regarding the speed and 2% regarding the torque, even in stand still.
The main disadvantages are the huge computational capability required and the
compulsory good identification of the motor parameters [ROM 1].

2.1.3 – Field Acceleration method.


This method is based on avoiding the electromagnetic transients in the stator
currents, keeping its phase continuous. Therefore, the equations used can be
simplified saving the vector transformation in the controllers.
It is achieved some computational reduction, overcoming the main problem in the
vector controllers and then becoming an important alternative for the vector
controllers [BED 5] [ROM 1] [YAM 1].

2.1.4 - Direct Torque Control.


In Direct Torque Control it is possible to control directly the stator flux and the torque by
selecting the appropriate inverter state.
Its main features are as follows [LUD 1] [VAS 2]:
§ Direct torque control and direct stator flux control.
§ Indirect control of stator currents and voltages.
§ Approximately sinusoidal stator fluxes and stator currents.
§ High dynamic performance even at locked rotor.

2.2
Direct Torque Control. Principles and Generalities.

This method presents the following advantages:


§ Absence of co-ordinate transform.
§ Absence of voltage modulator block, as well as other controllers such as PID for
flux and torque.
§ Minimal torque response time, even better than the vector controllers.
Although, some disadvantages are present:
§ Possible problems during starting.
§ Requirement of torque and flux estimators, implying the consequent parameters
identification.
§ Inherent torque and flux ripples.

2.3
Direct Torque Control. Principles and Generalities.

2.2 - Principles of Direct Torque Control.

2.2.1 - Introduction.
As it has been introduced in expression 1.81, the electromagnetic torque in the three-
phase induction machines can be expressed as follows [BOL 1][VAS 2]:

t e = 32 P ψ s × i s (2.1)

Where ψ s is the stator flux, i s is the stator current (both fixed to the stationary
reference frame fixed to the stator) and P the number of pairs of poles. The previous
equation can be modified and expressed as follows:

t e = 32 P ψ s ⋅ i s ⋅ sin (α s − ρ s ) (2.2)

Where ρ s is the stator flux angle and α s is the stator current one, both referred to the
horizontal axis of the stationary frame fixed to the stator.
If the stator flux modulus is kept constant and the angle ρ s is changed quickly, then
the electromagnetic torque is directly controlled.
The same conclusion can be obtained using another expression for the
electromagnetic torque. From equation 1.83, next equation can be written:

ψ r × ψ s ⋅ sin(ρ s − ρ r )
3 Lm '
te = P
2 Ls L r − Lm
2
(2.3)
Because of the rotor time constant is larger than the stator one, the rotor flux changes
slowly compared to the stator flux; in fact, the rotor flux can be assumed constant.
(The fact that the rotor flux can be assumed constant is true as long as the response
time of the control is much faster than the rotor time constant). As long as the stator
flux modulus is kept constant, then the electromagnetic torque can be rapidly
changed and controlled by means of changing the angle ρ s − ρ r [TAK 2] [VAS 2].

2.2.2 - DTC Controller.


The way to impose the required stator flux is by means of choosing the most suitable
Voltage Source Inverter state. If the ohmic drops are neglected for simplicity, then

2.4
Direct Torque Control. Principles and Generalities.

the stator voltage impresses directly the stator flux in accordance with the following
equation:
dψ s
= us
dt (2.4)
Or:
∆ ψ s = u s ∆t (2.5)

Decoupled control of the stator flux modulus and torque is achieved by acting on the
radial and tangential components respectively of the stator flux-linkage space vector
in its locus. These two components are directly proportional (Rs=0) to the
components of the same voltage space vector in the same directions.
Figure 2.1 shows the possible dynamic locus of the stator flux, and its different
variation depending on the VSI states chosen. The possible global locus is divided
into six different sectors signalled by the discontinuous line.

v3(010) v2(110) 2
3
v3(FD,TI)

v2 (FI,TI)

v6(FI,TD)
v4(011) v5(FD,TD)

v1(100)
4
1

5 6
v5(001) v6(101)

Figure 2.1. Stator flux vector locus and different possible switching
voltage vectors. FD: flux decrease. FI: flux increase. TD: torque decrease.
TI: torque increase.

In Accordance with figure 2.1, the general table II.I can be written. It can be seen
from table II.I, that the states Vk and Vk+3 , are not considered in the torque because
they can both increase (first 30 degrees) or decrease (second 30 degrees) the torque
at the same sector depending on the stator flux position. The usage of these states for

2.5
Direct Torque Control. Principles and Generalities.

controlling the torque is considered one of the aims to develop in the present thesis,
dividing the total locus into twelve sectors instead of just six [LUD 1].

VOLTAGE VECTOR INCREASE DECREASE


Stator Flux V k ,V k+1 ,V k -1 V k+2 ,V k-2 ,Vk+3
Torque V k+1 ,V k+2 V k - 1 ,V k - 2

Table II.I: General Selection Table for Direct Torque Control, being "k"
the sector number.

Finally, the DTC classical look up table is as follows:

Φ τ S1 S2 S3 S4 S5 S6

TI V2 V3 V4 V5 V6 V1
FI T= V0 V7 V0 V7 V0 V7
TD V6 V1 V2 V3 V4 V5
TI V3 V4 V5 V6 V1 V2
FD T= V7 V0 V7 V0 V7 V0
TD V5 V6 V1 V2 V3 V4

Table II.II. Look up table for Direct Torque Control.


FD/FI: flux decrease/increase. TD/=/I: torque decrease/equal/increase.
Sx: stator flux sector. Φ: stator flux modulus error after the hysteresis block.
τ: torque error after the hysteresis block.

The sectors of the stator flux space vector are denoted from S 1 to S6 . Stator flux
modulus error after the hysteresis block (Φ ) can take just two values. Torque error
after the hysteresis block ( τ) can take three different values. The zero voltage vectors
V0 and V7 are selected when the torque error is within the given hysteresis limits, and
must remain unchanged.

2.6
Direct Torque Control. Principles and Generalities.

2.2.3 - DTC Schematic.


In figure 2.2 a possible schematic of Direct Torque Control is shown. As it can be
seen, there are two different loops corresponding to the magnitudes of the stator flux
and torque. The reference values for the flux stator modulus and the torque are
compared with the actual values, and the resulting error values are fed into the two-
level and three-level hysteresis blocks respectively. The outputs of the stator flux
error and torque error hysteresis blocks, together with the position of the stator flux
are used as inputs of the look up table (see table II.II). The position of the stator flux
is divided into six different sectors. In accordance with the figure 2.2, the stator flux
modulus and torque errors tend to be restricted within its respective hysteresis bands.
It can be proved that the flux hysteresis band affects basically to the stator-current
distortion in terms of low order harmonics and the torque hysteresis band affects the
switching frequency [VAS 2].
The DTC requires the flux and torque estimations, which can be performed as it is
proposed in figure 2.2 schematic, by means of two different phase currents and the
state of the inverter.

Flux ref +
-

Torque ref + Selection


VSI induction
Table motor
-

flux sector

VSI state

stator flux
torque
estimators

Figure 2.2. Direct Torque Control schematic.

However, flux and torque estimations can be performed using other magnitudes such as two
stator currents and the mechanical speed, or two stator currents again and the shaft position
[LUD 1] [TAK 2].

2.7
Direct Torque Control. Principles and Generalities.

2.2.3.1 - Stator flux and torque estimator using wm , isA and isB magnitudes.
This estimator does not require co-ordinate transform. It is used the motor model
fixed to the stationary reference frame fixed to the stator.
Firstly, all three-phase currents must be converted into its D and Q components. By
means of the Park transformation defined in equation 1.14, it can be said:
i sD = c ⋅1.5 ⋅ i sA
i sQ = c ⋅ 3
2 ⋅ (2 ⋅ i sB + i sA ) (2.6)
If rotor current is isolated from equation 1.65 and substituted into 1.66 it can be said:
'
(
ψ r ⋅ 1 + p ⋅ L r R r − j L r ⋅PR⋅wm = L m i s
r
) (2.7)

And if the expression 2.7 is rearranged:

ψ r ⋅ (R r + p ⋅ L r ) = L m R r ⋅ i s + j ⋅ ψ r ⋅ L r ⋅ P ⋅ wm (2.8)
' '

Expanding the previous equation into its D and Q components, is obtained:

ψ rD ⋅ (R r + p ⋅ L r ) = L m R r ⋅ i sD − ψ rQ ⋅ L r ⋅ P ⋅ wm
' ' (2.9)

ψ rQ ⋅ (R r + p ⋅ L r ) = L m R r ⋅ i sQ + ψ rD ⋅ L r ⋅ P ⋅ wm (2.10)
' '

And taking into account that this expression will be evaluated in a computer it should
be expressed in z operator instead of p one. Therefore doing the z transform of
equations 2.9 and 2.10 the following equation are obtained:
−  Tz
Rr

 −  r
R  Tz
  1− e  Lr  L R ⋅ i sD − ⋅ψ ' ⋅ L ⋅ P ⋅ wm
ψ rD ⋅  z − e  L r  =
'

  Rr  m r rQ r
 (2.11)
 

−  Tz
Rr

 −  r
R  Tz
L r 
 1− e  Lr  L R ⋅ i sQ + ⋅ψ ' ⋅ L ⋅ P ⋅ wm
'

ψ rQ ⋅ z − e  =
  Rr  m r rD r
 (2.12)
 
And in time variable:
− R r  Tz
− R r  Tz 1−e
(L (k − 1) − L r ⋅ P ⋅ ψ 'rQ (k − 1) ⋅ wm(k − 1))
 Lr 
ψ 'rD (k ) = ψ 'rD (k − 1) ⋅ e  Lr 
+ m R r i sD (2.13)
Rr

− R r  Tz
− R r  Tz 1−e
(L (k − 1) + L r ⋅ P ⋅ ψ 'rD (k − 1) ⋅ wm(k − 1))
 Lr 
ψ 'rQ (k ) = ψ 'rQ (k − 1) ⋅ e  Lr 
+ m R r i sQ (2.14)
Rr

2.8
Direct Torque Control. Principles and Generalities.

Finally, stator flux can be obtained as follows:


ψ sD (k ) = i sD (k ) ⋅ LL x + ψ 'rD (k ) ⋅ LLm (2.15)
m r

ψ sQ (k ) = i sQ (k ) ⋅ LL x + ψ 'rQ (k ) ⋅ LLm (2.16)


m r

Torque is obtained using equation 1.82.

2.2.3.2 - Stator flux and torque estimator using Vdc , isA and isB magnitudes.
In case that sensor-less direct torque control is desired, neither rotor speed nor rotor
position are available. In order to obtain an estimation of the stator flux space vector,
two possible methods may be applied:
§ An estimation that does not require speed or position signals may be used.
§ The motor speed may be estimated and fed into a flux estimator.
Stator flux and torque estimation based on the stator voltage equation does not
require speed or position information when stationary co-ordinates are applied. Thus,
from the VSI state and having the instantaneous value of the Vdc , it can be deduced
the voltages in each phase. Once the voltage and the current values are calculated
and measured respectively, they are transformed in D and Q components by means of
Park transformations.
Finally from equation 1.64 it can be said:

ψs = ∫(u s )
− R s ⋅ i s dt (2.17)

And expressing this equation in z operator by means of the z transform:

ψs =
z −1
(
⋅ Ts ⋅ u s − R s ⋅ i s ) (2.18)
1 − z −1
Expressing the previous equation in time and in its D and Q components:
ψ sD (k ) − ψ sD (k − 1) = Ts ⋅ u sD (k − 1) − Ts ⋅ R s ⋅ i sD (k − 1)

ψ sQ (k ) − ψ sQ (k − 1) = Ts ⋅ u sQ (k − 1) − Ts ⋅ R s ⋅ i sQ (k − 1) (2.19)

It may be deduced that the stator voltage space vector components are derived from the
inverter internal switch settings. This fact avoids the measurement of the stator voltage pulses.
In practice, the D.C. link voltage is measured, thus the D and Q components of the stator
voltage space phasor can be derived. It should be noted that a co-ordinate transform is not

2.9
Direct Torque Control. Principles and Generalities.

required. However, the accuracy of the estimation is limited due to the open loop integration
that can lead to large flux estimation errors [LUD 1].

2.2.4 - Parameter detuning effects.


Stator flux and torque estimators DTC based systems, shown in sections 2.2.3.1 and 2.2.3.2,
depart from their ideal behaviour when the motor model parameters used are not different
from the true motor model parameters. It can be proved that estimators that uses either
position or speed have similar characteristics, which are good enough, as long as the
estimated parameters have an error lower than 10%. However, the estimator that uses Vdc
performs very poorly when just small errors of its parameters are present [LUD 1].
In further chapters will be used the estimator introduced in section 2.2.3.1.

2.10
Direct Torque Control. Principles and Generalities.

2.3 - Improvements in Direct Torque Control.

2.3.1 - Introduction.
In the classical DTC, there are several drawbacks. Some of them can be summarised as
follows:
§ Sluggish response (slow response) in both start up and changes in either flux or torque.
§ Large and small errors in flux and torque are not distinguished. In other words, the same
vectors are used during start up and step changes and during steady state.
In order to overcome the mentioned drawbacks, there are different solutions, which can be
classified as follows:
§ Non artificial intelligence methods, mainly "sophisticated tables".
§ Predictive algorithms, used to determine the switching voltage vectors. A mathematical
model of the induction motor is needed. Electromagnetic torque and stator flux, are
estimated for sampling period for all possible inverter sates. Then, the predictive
algorithm selects the inverter switching states to give minimum deviation between the
predicted value of the electromagnetic torque and the reference torque.
§ Fuzzy logic based systems.
Next sections deal with all these methods, achieving a good knowledge of all them in order to
realise the best DTC improvement.

2.3.2 – Different tables.


2.3.2.1- First approach.
2.3.2.1.1 - Six sector table but different zones.
First idea that comes up, when it is tried to improve the DTC by means of changing the tables,
is to use six sectors, as in classical DTC, but changing the zones. Hence, instead of having as
a first sector the zone from -30º up to 30º, it will be from 0º up to 60º. It can be observed that
in this case, the states not used in the first zone will be V3 and V6 instead of V1 and V4 . This
novel sector division is shown in figure 2.3.

2.11
Direct Torque Control. Principles and Generalities.

2
3
v3(010) v2(110) v3(010) v2(110) tg
tg
2 1 v2 (FI,TI)
v2 (FI,TI) n
3 v4(FD,TI)
v3(FD,TI) n v1(FI,TD)
v4(011) v5(FD,TD) v6(FI,TD) v4(011) v5(FD,TD)

v1(100) v1(100)
4
4 6
1
5
5 6
v5(001) v6(101) v5(001) v6(101)

Figure 2.3. Left: Classical DTC and its six sectors.


Right: Modified DTC and its new six sectors.

In Accordance with the figure 2.3, the general table II.III can be written.

CLASSICAL DTC MODIFIED DTC


-30º → 30º 0º → 60º
V1 30º → -30º 0º → -60º
Torque ambiguity TD, FI
V2 90º → 30º 60º → 0º
TI, FI TI, FI
V3 150º → 90º 120º → 60º
TI, FD Flux ambiguity
V4 -150º → 150º 180º → 120º
Torque ambiguity TI, FD
V5 -90º → -150º -120º → -180º
TD, FD TD, FD
V6 -30º → -90º -60º → -120º
TD, FI Flux ambiguity

Table II.III: Behaviour of each state just in the first zone for the classical
DTC (left) and the modified DTC (right). It is shown the angle of the
voltage vector in the sector with reference to the normal and tangential
axis. TI/TD: Torque Increase/Decrease. FI/FD: Flux Increase/Decrease

It can be seen that the states V1 and V4 , are not used in the classical DTC (c_DTC)
because they can increase or decrease the torque at the same sector depending on if
the position is in its first 30 degrees or in its second ones. In the modified DTC
(m_DTC), V 3 and V6 are the states not used. However, now the reason is the

2.12
Direct Torque Control. Principles and Generalities.

ambiguity in flux instead of torque, as it was in the c_DTC. This is considered to be


an advantage in favour of the m_DTC as long as the main point is to control the
torque. Therefore, it is better to loose the usage of two states for flux ambiguity that
for torque one.
Table II.IV shows the m_DTC look up table for all its six sectors.

Φ τ S1 S2 S3 S4 S5 S6
TI V2 V3 V4 V5 V6 V1
FI T= V0 V7 V0 V7 V0 V7
TD V1 V2 V3 V4 V5 V6
TI V4 V5 V6 V1 V2 V3
T= V7 V0 V7 V0 V7 V0
FD
TD V5 V6 V1 V2 V3 V4

Table II.IV. Look up table for Modified DTC. FD/FI: flux decrease/increase.
TD/=/I: torque decrease/equal/increase.
Sx: stator flux sector. Φ: stator flux modulus error after the hysteresis block.
τ: torque error after the hysteresis block.

2.3.2.1.2 - Twelve sector table.


In classical DTC there are two states per sector that present a torque ambiguity. Therefore,
they are never used. In a similar way, in the modified DTC there are two states per sector that
introduce flux ambiguity, so they are never used either.
It seems a good idea that if the stator flux locus is divided into twelve sectors instead of just
six, all six active states will be used per sector. Consequently, it is arisen the idea of the
twelve sector modified DTC (12_DTC). This novel stator flux locus is introduced in figure
2.4. Notice how all six voltage vectors can be used in all twelve sectors. However, it has to be
introduced the idea of small torque increase instead of torque increase, mainly due to the fact
that the tangential voltage vector component is very small and consequently its torque
variation will be small as well.

2.13
Direct Torque Control. Principles and Generalities.

V3 V2

4 3

5 2 V3(FD,TI) V2 (FI,TI)

V4(FD, TsI) V1(FI, TsD)


6 1
V4 V5(FD,TD) V6(FI,TD)

7 V3(FD,TI) V2 (FI,TI)
12
V4(FD, TsD) V1(FI, TsI)

8 V5(FD,TD) V6(FI,TD)
11
9 10

V3 V2

Figure 2.4. Twelve sector modified DTC (12_DTC) and its sectors.
FD/FI: flux decrease/increase. TD/TI: torque decrease/increase. TsD/TsI: torque
small decrease/increase. Notice how all six voltage vectors can be used in all twelve
sectors, disappearing all ambiguities.

Table II.V can be written when a twelve-sector locus is used.

S 12 INCREASE DECREASE
Stator Flux V 1 , V2 , V6 V 3 , V4 , V5
Torque V 1 , V2 , V3 V 4 , V5 , V6
S1 INCREASE DECREASE
Stator Flux V 1 , V2 , V6 V 3 , V4 , V5
Torque V 2 , V3 , V4 V 5 , V6 , V1

Table II.V: Table for sectors 12 and 1 in the 12_DTC. Notice how all six
voltage vectors can be used in all sectors disappearing all ambiguities.

As it has been mentioned in the previous paragraph, it is necessary to define small and large
variations. It is obvious that V1 will produce a large increase in flux and a small increase in
torque in sector S12 . On the contrary, V2 will increase the torque in large proportion and the
flux in a small one.

2.14
Direct Torque Control. Principles and Generalities.

It is reasonable to deduce that the torque error should be divided in the number of intervals
that later on will be measured. Therefore, the hysteresis block should have four hysteresis
levels at is suggested in table II.VI.
If the flux and torque effects are divided into eight groups, it can be drawn figure 2.5.

tg torque

150º TI FD TI FI 30º

TsI FD TsI FI n
TsD FD TsD FI
flux
-150º
TD FD TD FI -30º

Figure 2.5. Eight levels of flux and torque variation for the flux stator locus in the
12_DTC. FD/FI: flux decrease/increase. TD/TI: torque decrease/increase. TsD/TsI:
torque small decrease/increase. Notice how all six active voltage vectors can be used
in all twelve sectors, disappearing all ambiguities.

Finally, the look up table is presented in table II.VI.

Φ τ S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12


TI V2 V3 V3 V4 V4 V5 V5 V6 V6 V1 V1 V2
FI TsI *V2 V2 *V3 V3 *V4 V4 *V5 V5 *V6 V6 *V1 V1
TsD V1 *V1 V2 *V2 V3 *V3 V4 *V4 V5 *V5 V6 *V6
TD V6 V1 V1 V2 V2 V3 V3 V4 V4 V5 V5 V6
TI V3 V4 V4 V5 V5 V6 V6 V1 V1 V2 V2 V3
FD TsI V4 *V4 V5 *V5 V6 *V6 V1 *V1 V2 *V2 V3 *V3
TsD V7 V5 V0 V6 V7 V1 V0 V2 V7 V3 V0 V4
TD V5 V6 V6 V1 V1 V2 V2 V3 V3 V4 V4 V5

Table II.VI: Switching table for the 12_DTC.


FD/FI: flux decrease/increase. TD/=/I: torque decrease/equal/increase.
Sx: stator flux sector. Φ: stator flux modulus error after the hysteresis block.
τ: torque error after the hysteresis block.
(* there is no suitable state. It has been chosen the second most suitable).

2.3.2.1.3 - Simulations, results and conclusions.


In order to compare the responses, it is needed an index error. The one that is used is IE2,
which is the integral of the square error. It should be noted the fact that the index is computed

2.15
Direct Torque Control. Principles and Generalities.

by means of the square error instead of just the error; therefore, the more error is produced the
more emphasis it is given in the index.
The torque reference value is described in figure 2.6.
Te

6.7

0.05 0.25 1.5

t
-6.7

-13.4

Figure 2.6. Input torque reference value.

Stator flux set point was set to its nominal value. All simulations have been done just for the
Motor_1kW (see chapter 4).
The torque load was proportional to the motor speed, and it was equal to the nominal motor
torque at nominal speed.
The simulated results for first approach modified DTC are shown in table II.VII. Results are
not as good as expected.
IE2 Flux Torque
c_DTC 0.003161 1.019
m_DTC -- --
12_DTC 0.002869 1.3509

Table II.VII: IE2 values after the simulations. The reference torque value is shown
in figure 2.6, and the stator reference flux value was the nominal one.
( -- meaning that it didn't work).

Conclusions:
§ At the beginning and end of each sector, the flux locus is worse in both c_DTC and
m_DTC. It was believed that 12_DTC would solve this problem but it didn't.
§ It is observed that c_DTC performs better in steady state flux and worse in transient flux.
However, it performs worse in steady state torque and better in transient torque.
§ It is observed that m_DTC performs worse in steady state flux and better in transient flux.
However, it performs better in steady state torque and worse in transient torque.

2.16
Direct Torque Control. Principles and Generalities.

§ If the stator flux locus is observed the evolution is as shown in figure 2.7.

c_DTC m_DTC

Figure 2.7. Evolution of the flux stator locus in the classical DTC and modified
DTC. It can be seen how the flux ripple is higher in the m_DTC than in the c_DTC.

§ According to the definition given in figure 2.5, it can be said that all the states in m_DTC
produce large variation in flux, meanwhile the ones in c_DTC produce large variation in
torque. Table II.VIII can be written. This fact explains both, the locus in figure 2.7 in the
previous conclusion and why the m_DTC is unable to reach nominal conditions. It can be
concluded that depending on the voltage vector angle referred to the normal reference
axis, the variation in flux and torque will be either small or large.
S1 c_DTC m_DTC
-30º → 30º 0º → 60º
V1 30º → -30º 0º → -60º
Not used Flux large
V2 90º → 30º 60º → 0º
Torque large Flux large
V3 150º → 90º 120º → 60º
Torque large Not used
V4 -150º → 150º 180º → 120º
Not used Flux large
V5 -90º → -150º -120º → -180º
Torque large Flux large
V6 -30º → -90º -60º → -120º
Torque large Not used

Table II.VIII. Behaviour of each state just in the sector 1 for the classical DTC (left)
and the modified DTC (right). It is shown the angle of the voltage vector in the
sector with reference to the normal axis. Large flux and large torque variations.

§ States, which are supposed to increase the torque in a small way (because they are either
between 0º and 30º or 150º and 180º), don't increase the torque at all. Instead they do
decrease the torque.
§ If index error flux (IE2) improves, the torque one becomes worse and the other way
round. It seems almost impossible to improve both at the same time.

2.17
Direct Torque Control. Principles and Generalities.

2.3.2.2 - Second approach.


After the bad previous results regarding c_DTC, m_DTC and 12_DTC; it is done a further
investigation in order to find out why the expectations were not achieved.

m_DTC c_DTC Stator


TI / FI TI / FD TI / FI TI / FD Flux angle
0º 120º 120º 60º
60º
15º 135º V3 75º V4 135º 45º
V2 30º V4 150º 90º /º30º 150º / 90º 30º
45º 165º 45º 105º 15º
60º / 0º 180º / 120º V2 60º V3 120º 0º
15º 135º 75º 135º -15º
V1 30º V3 150º 90º / 30º 150º / 90º -30º
45º 165º 45º 105º -45º
V1 V2
60º 180º 60º 120º -60º

small torque medium torque large torque

Table II. IX. It is shown different possibilities for choosing the appropriate states
attending the criteria of the level of torque variation required. Just for the stator flux
angle from -60º up to 60º. It is shown the angles of each voltage vector referred to
the tangential and normal reference axis.

From table II.IX seems evident that for nominal torque the best table is the c_DTC because
large torque variation must be available. However, for small torque m_DTC is more
appropriate because small torque variations are needed. On the other hand, 12_DTC has got
plenty of sense when medium torque is required. This fact gives the idea that could be worthy
use different tables depending on the working point, which means depending on both the
speed and torque. Hence, four general working points are distinguished:
Te

100%
2 4

30%
1 3
10% 100% wm

Figure 2.8. It is shown the typical torque-speed induction motor characteristic. It is


defined four working points.

2.18
Direct Torque Control. Principles and Generalities.

Simulations have done during 1.5s. Torque and flux reference values have been set to its
nominal values for the motor 1_kW (see chapter4).

IE2 c_DTC m_DTC


Work point Flux Torque Flux Torque
1 0.0177 0.3383 0.0023447 0.25697
2 0.00304 0.6084 0.0018883 0.56425
3 0.01592 0.5748 --- ---
4 0.03161 1.019 --- ---

Table II.X. IE2 simulated values. ( --- meaning that it didn't work).

Conclusions:
§ It is born the idea of the working point, due to the fact that each working point has
different most suitable look up table.
§ It is proved why in nominal conditions the best was c_DTC.

2.3.2.3 - Third approach.


It has been observed that some states don't behave, as they should, regarding torque. It should
be remembered that if its tangential component in the flux locus is positive the state is
supposed to increase the torque and the other way round. However, a more accurate study of
the torque expression gives the idea that the torque just depends on the "sin(ρs-ρr)", as it is
introduced in expression 2.3.
Once the speed is high, then the angle of the stator flux increases fast. Under these
circumstances, states that are supposed to increase the torque do it in a very small quantity.
Null states, which are supposed to keep the torque in the same level, decrease it in a notable
way. Finally, the voltage states which are supposed to decrease the torque do it but in a very
strong way, producing a big ripple in the torque response. Once one of the decreasing states is
applied, it is needed several increasing states to recuperate the set point value again.
This fact leads to the idea of modifying the c_DTC table once the working point is near to
nominal conditions; that is to say, always than both magnitudes are higher than 50% of the
nominal conditions. In this new table, the decreasing states are not used and the null states are

2.19
Direct Torque Control. Principles and Generalities.

used instead. The states that are used for maintaining the torque value, are the increasing ones.
Hence, another modified DTC (m2_DTC) is created and its table is shown in table II.XI.

Φ τ S1 S2 S3 S4 S5 S6

TI V2 V3 V4 V5 V6 V1
FI T= V2 V3 V4 V5 V6 V1
TD V0 V7 V0 V7 V0 V7
TI V3 V4 V5 V6 V1 V2
FD T= V3 V4 V5 V6 V1 V2
TD V7 V0 V7 V0 V7 V0

Table II.XI. Look up table for m2_DTC.


FD/FI: flux decrease/increase. TD/=/I: torque decrease/equal/increase.
Sx: stator flux sector. Φ: stator flux modulus error after the hysteresis block.
τ: torque error after the hysteresis block.

Simulation results for working point 4, which were performed in the same conditions as in
2.3.2.2, have been as follows:
IE2 Flux Torque
c_DTC 0.003161 1.019
m2_DTC 0.003171 0.6731

Table II.XII. IE2 simulated values for the classical DTC and the second modified
DTC.

From this third approach can be concluded that when the working point is near to the nominal
conditions, it is a good idea do not use the torque decreasing states and use the null ones
instead. Under the same circumstances, for torque maintaining states is better use the increase
states instead of the null ones.

2.3.2.4 - Conclusions.
Several conclusions from, all this different look up tables study, have been obtained:
§ There is not a remarkable improvement in the motor performance changing the look up
tables. However, some little improvements can be achieved.

2.20
Direct Torque Control. Principles and Generalities.

§ The working point determines the most suitable voltage state. In other words, the most
suitable state not only depends on flux and torque error values and on the sector, but also
on the working point (torque and speed values).
§ The voltage vector angle referred to the normal reference axis implies a small or large
variation in stator flux and torque.
§ If the working point is high, the torque decreasing states are forbidden because they
introduce a high ripple. Instead of them, it is much better to use the null states.

2.3.3 – Predictive methods.


The point of this method is to choose the switching vectors that are in accordance with the
range of flux and torque errors, overcoming therefore, one of the main drawbacks of the
classical DTC. For this purpose a suitable mathematical model of the induction machine is
used and the electromagnetic torque is estimated for each sampling period for all possible
inverter modes. The predictive algorithm then selects the inverter switching states to give
minimum deviation between the predicted electromagnetic torque and the reference torque.
It is obtained a reference voltage value; therefore Space Vector Modulation has to be applied
[ARI 1]. If the machine is not in steady state, the probability of obtaining a reference voltage
decreases. In this case, the classical DTC will be applied.
The main problems for this solution are the procedure for calculating the voltage reference
and the following decomposition by means of SVM. The calculation of the voltage reference
value and the SVM need a high computation capability, loosing one of the best advantages of
DTC, which is its simplicity in calculus. Moreover, in any transient this predictive method
won't work properly being compulsory the usage the classical DTC instead.
A brief summary of the mathematical expression for implementing this method is introduced
in equations (2.20) and (2.21) [CAS 1] [HAB1] [VAS 2].
Equations (2.20) and (2.21) show the fact that this method increases the calculus of the drive
in a considerable way. Moreover, a good machine model is needed in order to know all the
parameters that appears in equation (2.20). Therefore, the mentioned method is not considered
a good solution for improving the DTC.
In order to obtain the voltage reference value, equations (2.20) must be solved.

2.21
Direct Torque Control. Principles and Generalities.

2
a ⋅ u ref _ D + b ⋅ u ref _ D + c = 0
2
a = Tz2 +  sQ z ψ 
ψ ⋅T

 sD 

b = 2 ⋅ α ⋅ ψsQ ⋅ ( ) + 2⋅ T ⋅ ψ
2
Tz
ψ sD
2
z sD + 2 ⋅ ψ sQ ⋅ Tz ψ
2

sD

c = 2 ⋅ α ⋅ Tz ⋅  sQ ψ  + ψ 2sD + ψ 2sQ − ψs2 _ ref


2
ψ

 sD 

2 ⋅∆ t e ⋅L s (2.20)
α= 3 ⋅ P⋅ T z
+ ψsD ⋅ esQ − ψ sQ ⋅ esD

Once the reference voltage value is obtained, it must be added the stator resistance drops.

v ref = u ref + R s ⋅ i s (2.21)

This thesis, after being studied this predictive method, will be focused on the Fuzzy Logic
controllers, because it is thought that they can improve in a better way the classical DTC
without increasing the complexity in calculus that much.

2.3.4 - Fuzzy logic based systems.


In the classical DTC induction motor drive there are torque and flux ripples because none of
the inverter switching vectors is able to produce the desired changes in both torque and stator
flux. However, using various techniques can be reduced the ripples in the electromagnetic
torque and stator flux. Some of these techniques involve the usage of high switching
frequencies or the change in inverter topology, but it is also possible to use schemes which do
not involve any of the mentioned techniques, such as the duty ratio control [BIR 1] [VAS 3].
In DTC induction motor drive, the increase of switching frequency is desirable since it
reduces the harmonic content of the stator currents, and also leads to reduce torque harmonics.
However, if high switching frequency is used, it will result in an increment of switching
losses (leading to an efficiency reduction). It also will increase the stress of the semiconductor
devices of the inverter. Furthermore, in case of high switching frequency, a fast processor is
required since the control processing time becomes small. This increases the cost.
When changed the inverter topology is used, it is possible to use an increased number of
switches, but this will also increase the costs [MAR 2].
However, it is also possible to use schemes, such as duty ratio control, which do not involve
using inverters with a higher number of switches.

2.22
Direct Torque Control. Principles and Generalities.

In the classical DTC induction motor drive a voltage vector is applied for the entire period,
and this causes the stator current and electromagnetic torque exceeds its reference value early
during the cycle, causing a high torque ripple. Switching cycles then follows this, in which the
zero switching vectors are applied in order to reduce the electromagnetic torque to reference
value.
The suggested technique is based on applying to the inverter the selected active states just
enough time to achieve the torque and flux references values. The rest of the switching period
a null state is selected which won't almost change both the torque and the flux. Therefore, a
duty ratio (δ) has to be determined each switching time. By means of varying the duty ratio
between its extreme values (0 up to 1) it is possible to apply any voltage to the motor.
The optimum duty ratio per sampling period is a non-linear function of the electromagnetic
torque error, the stator flux position and the working point, which is determined by the motor
speed and the electromagnetic torque. It is obvious that it is extremely difficult to model such
an expression since it is a different non-linear function per working point. Thus, it is believed
that by using a Fuzzy Logic based DTC system it is possible to perform a fuzzy-logic-based
duty-ratio controller, where the optimum duty ratio is determined every switching period
[BIR 1][VAS 3].
The mentioned Fuzzy Logic method is considered a good solution for improving the DTC.
This thesis after being studied this method will be focused on the Fuzzy Logic controllers,
because it is thought that they can improve in a better way the classical DTC without
increasing the complexity in calculus that much.

2.3.5 - Regulating the flux.


As it has been explained in the previous sections, the ripples in the electromagnetic torque and
stator flux are extremely reduced by using controllers based on Fuzzy Logic systems or
predictive methods. However, in order to obtain even a better reduction, stator flux reference
value has to be adapted to an optimum value, which should be just large enough to produce
the desired torque. The reason is that with this optimum value the increase in the active state
is just large enough and the slight reduction in the null states is lower. Moreover, it is
achieved a reduction in the power reactive consumption taken from the mains supply.

2.23
Direct Torque Control. Principles and Generalities.

The optimum expression, which gives the just large enough stator flux for the desired torque
is obtained from expressions 1.97, 1.98 and 1.99. Re-arranging the mentioned expressions, the
final expression, which relates the stator flux and the torque, is given in 2.22

ψs =
[Rr
s (L s1 + 32 Lsm )]2 + [ws (L r1 (Ls1 + 3 2 L sm ) + 3 2 Lsm L s1 )]2
T
3 P 2 R s 1 w (ws 3 2 Lsm )2
r
s
(2.22)

Equation 2.22 can be presented as in equation 2.23.

ψ s = cte ⋅ T

cte =
[
Rr
s ( L s1 + 3 2 L sm )]2 + [w sn ( L r 1 ( L s1 + 3 2 L sm )+ 3 2 L sm L s1 )]2
3 P 2 R r s 1 w sn ( w sn 3 2 L sm )2 (2.23)

Finally the schematic of the DTC based on fuzzy controllers and optimising its reference
stator flux value is as follows:

Flux ref optimized

cte +
-

sqr

Selection induction
Torque ref + Table VSI
motor
-

flux sector

VSI state

stator flux
torque
estimators

Figure 2.9. Flux reference optimised controller in a classical DTC.

It should be noted that this optimised stator flux value it is not only valid in DTC but also in
any drive.

2.24
Direct Torque Control. Principles and Generalities.

2.4 - Interim conclusions.

It has been explained the basic concepts of the Classical Direct Torque Control. Two different
estimators for the stator flux and torque have been fully developed. However, just the
estimator from section 2.2.3.1 has been used in further chapters and has been implemented for
the further experimental results.
Despite the fact that the aim of this thesis is not the parameters detuning effects, it has been
studied its main effects and has been shortly summarised in section 2.2.4.
Four different methods for improving the classical DTC, which is the aim of the thesis, have
been studied and deeply discussed:
§ The first method is the search of a better look up table. After the research done in this
field, it can be concluded that by means of changing the table can not be remarkably
improved the DTC performance. However, some little improvements can be achieved.
Many conclusions have been obtained in this study, being the fundamental ideas for the
development of the most suitable Fuzzy Logic controller, as it is explained in next section
3.2.1.1.
§ The second method is the predictive one. It has been concluded that it is too complicated
regarding its real implementation because of its calculus, eliminating one of the DTC
advantages, which is its simplicity.
§ The application of the Fuzzy Logic for implementing a simple modulation between the
selected active state and a null one, is the third method. It can be concluded that this
method is very promising and this thesis will be focused on that in the following chapters.
§ Finally, the fourth method is the regulation of the stator flux reference value. This method
can be applied in any motor drive. Not only it reduces the torque ripple improving the
motor performance, but also reduces the power reactive consumption taken from the
mains supply. Therefore, this method will be considered in further sections as well.

2.25
CHAPTER 3.
FUZZY LOGIC DIRECT TORQUE CONTROL.

3.1 - Introduction.

In DTC induction motor drive there are torque and flux ripples because none of the VSI states
is able to generate the exact voltage value required to make zero both the torque
electromagnetic error and the stator flux error.
The suggested technique is based on applying to the inverter the selected active states just
enough time to achieve the torque and flux references values. A null state is selected for the
remaining switching period, which won't almost change both the torque and the flux.
Therefore, a duty ratio (δ) has to be determined each switching time. By means of varying the
duty ratio between its extreme values (0 up to 1), it is possible to apply any voltage to the

3.1
Fuzzy Logic Direct Torque Control.

motor. Therefore, this technique is based on a two-state modulation. These two states are the
active one and a null one.
The optimum duty ratio per sampling period is a non-linear function of the electromagnetic
torque error, the stator flux position and the working point, which is determined by the motor
speed and the electromagnetic torque. It is obvious that it is extremely difficult to model such
an expression since it is a different non-linear function per working point. Thus, it is believed
that by using a Fuzzy Logic based DTC system it is possible to perform a Fuzzy Logic based
duty-ratio controller, where the optimum duty ratio is determined every switching period
[BIR 1] [VAS 3].
The suggested Fuzzy Logic system is divided into two different Fuzzy Logic controllers. The
first one will act each time that the selected active VSI state has changed, being different to
the previous one. The second controller will act in the opposite situation, which is when the
active VSI selected state is the same as the previous one. These Fuzzy Logic controllers and
its functionality are explained deeper in section 3.2.
Both fuzzy logic controllers use the Centroid defuzzification method. The relation between
different conditions in the same rule is done by means of "and" operator. On the other hand,
the relationship between different rules is done by means of "or" operator.

3.2
Fuzzy Logic Direct Torque Control.

3.2 - Fuzzy Logic Direct Torque Control.

3.2.1 - Fuzzy Logic controller 1.

3.2.1.1- Objectives.
From the section entitled "first approach" (2.3.2.1) was lead the idea of small and large torque
increases or decreases (see figure 2.5). This idea will be taken into account by means of the
stator flux position as input of the Fuzzy Logic system.
From the section entitled "second approach" (2.3.2.2) was born the idea of the working point.
It does seem obvious that if the working point increases, then the duty cycle must tend to one
and in the opposite case the duty cycle must tend to zero. This idea is considered by means of
the working point membership input and its consequent distribution in the working plane.
Finally from the section entitled "third approach" (2.3.2.3) were born two main ideas. The
first one is that the higher the working point is, the more torque is decreased by the null states
(instead of keeping it constant). The second idea is that the torque decrease states decreases
the torque too much. As a solution, once a small decrease in torque is required, it will be
generated by means of modulating a torque increase state and a null one, being the result after
the entire period a small reduction in torque. The torque maintaining state will be generated
by means of a torque increase state, (which almost do not increase the torque under these
conditions), instead of a null one. In this Fuzzy Logic controller these ideas from the third
approach will be implemented by means of the working point and torque error inputs.

3.2.1.2- Inputs and output membership functions.


In such a Fuzzy Logic system, there are three inputs, stator flux position, electromagnetic
torque error and the motor working point i.e. speed and torque. The output is the duty ratio.
Stator flux
position

torque error duty ratio


Fuzzy logic
controller 1
f(wm,T)

Figure 3.1. Fuzzy Logic duty ratio estimator

3.3
Fuzzy Logic Direct Torque Control.

The fuzzy system comprises four groups of rules. Two of them are used when the stator flux
is smaller than its reference value (Flux increase) and the other two in the opposite case (Flux
decrease). The working point is firstly divided into two different cases. These two cases are
speed wpc higher than torque Tpc (both in percent) and the opposite case.
In any case just one fuzzy system is used per iteration, and it depends on the working point.
Fuzzy controller 1
Stator flux
position FI wp c<Tpc

torque error FI wp c>Tpc duty ratio

f(wm ,T) FD wp c<Tpc

FD wp c>Tpc

Figure 3.2. Fuzzy logic duty ratio estimator. It can be seen its four different groups
of rules. Just one group of rules is used per iteration.

Stator flux position membership function is decomposed in three fuzzy sets as it is shown in
figure 3.3.

s m l

Stator flux
position
0º 30º 60º

Figure 3.3. Stator flux position membership input.

The torque error membership function is decomposed in six fuzzy sets. The "tei" values are as
follows: te1=5%Tn, te2=10%Tn, te3=20%Tn, where Tn is the nominal torque value. The
absolute values will depend on the nominal values of each electrical machine.
n-l n-m n-s s m l

torque error

-te3 -te2 -te1 te1 te2 te3

Figure 3.4. Torque error membership input.

The motor working point membership function is decomposed in just three fuzzy sets.
However they are different depending on the working point position. The "wTi" values are as
follows: wT1=120, wT2=200, wT3=275, wT4=100, wT5=160, wT6=270.
The different zones in the working plane T,w can be seen in figure 3.5.

3.4
Fuzzy Logic Direct Torque Control.

It should be noted from figure 3.5 that the working plane behaviour can not be described by
means of three lines in his entire plane. Therefore, the working plane is divided into two
zones and the fuzzyfication of these two zones is as well different.
W pc <T pc W pc >T pc

s m l s m l

Tpc +2wpc 2Tpc +wpc


wT1 wT2 wT3 wT4 wT5 wT6

Tpc Tpc
wp c =Tpc wp c =Tpc

100% 100%

T pc +2wp c =wT3
2T p c +w p c =wT6

T pc +2w pc =wT2
2T p c +wp c=wT5
Tpc +2w pc =wT1

2T p c +wp c=wT4

100% wpc 100% wpc

Figure 3.5. Working point membership inputs and the three different zones in the
T,w plane. Left wpc<Tpc. Right wpc>Tpc.

Duty ratio membership function is decomposed in five fuzzy sets. Notice that its membership
values are single tone to simplify the calculation. The "dci" values are as follows: dc1=0.15,
dc2=0.50, dc3=0.75.

z s m l vl
1

duty ratio

0 dc1 dc2 dc3 1

Figure 3.6. Duty ratio membership.

3.2.1.3- Rules:
The fuzzy system comprises four groups of rules, each of which contains 46 rules. Two of
them are used when the stator flux is smaller than its reference value (Flux increase) and the
other two in the opposite case (Flux decrease). In any case just one fuzzy system is used per
iteration, and it depends on the working point.
All four groups of 46 rules are listed in section A.2.1.

3.5
Fuzzy Logic Direct Torque Control.

3.2.2 - Fuzzy Logic controller 2.

3.2.2.1- Objectives.
The objective is to create an adaptive system. As long as the selected state is not changed,
then taking into account the last evolution is possible to predict next duty ratio increment to
reduce the torque error. Two examples are shown in figure 3.7.

n-l n-l

n-m n-m
n-s n-s
Te* Te*
s s
m m

l l

Figure 3.7. It can be seen the evolution of the torque during one Tz. Left: if the
torque increment is negative medium, and the error in the previous iteration was
negative large, the duty ratio increment has to be small. This case corresponds to the
second rule (see section A.2.2). Right: if the torque increment is zero, and the error
in the previous state was small, the increment in duty ratio has to be zero. This case
corresponds to the seventeenth rule (see section A.2.2).

From figure 3.7 can be seen the adaptive characteristic of the Fuzzy Logic controller. On the
left of figure 3.7, it is obvious that next iteration should not decrease the duty ratio because
the torque value would take a value under the reference torque value. Therefore, the action
must be to increase a bit the duty cycle in order to place next torque value a bit above than the
torque reference value. However, on the right of figure 3.7, it is obvious that the torque
response has been excellent; therefore, it must continue with the same duty cycle value.

3.2.2.2- Inputs and output membership functions.


In such a Fuzzy Logic system, there are two inputs, torque increment and electromagnetic
torque error in the previous iteration. The output is the increment in duty ratio.

3.6
Fuzzy Logic Direct Torque Control.

∆ torque

Fuzzy logic ∆δ
torque error (i-1) controller 2

Figure 3.8. Fuzzy logic controller increment_duty ratio estimator.

The torque increment membership function is decomposed in seven fuzzy sets, and the torque
error in the previous iteration membership function is decomposed in six as shown in figure
3.9.

n-l n-m n-s z s m l n-l n-m n-s s m l

∆ torque torque error(i-1)


-te3 -te2 -te1 te1 te2 te3 -te3 -te2 -te1 te1 te2 te3

Figure 3.9. Torque increment and torque error in the previous iteration membership
inputs.

The "tei" values in both cases are as follows: te1=1%Tn, te2=5%Tn, te3=10%Tn, where Tn is
the torque nominal value. The absolute values will depend on the nominal values of each
machine.
The increment duty ratio membership function is decomposed in nine fuzzy sets. Notice that
its membership values are again single tone to simplify the calculation. The "∆δi" values are
as follows: ∆δ1=0.08, ∆δ2=0.15, ∆δ3=0.35 and ∆δ4=0.5.

n-vl n-l n-m n-s z s m l vl

∆δ

− ∆δ4 −∆δ3 −∆δ2 −∆δ1 0 ∆δ1 ∆δ2 ∆δ3 ∆δ4

Figure 3.10. Increment duty ratio membership.

3.2.2.3- Rules:
The fuzzy system contains 37 rules. The rules number two and seventeen are explained in
figure 3.7.
All 37 rules are listed in section A.2.2.

3.7
Fuzzy Logic Direct Torque Control.

3.2.3 - Fuzzy Logic DTC schema.


Finally the schematic of the DTC based on fuzzy controllers is as shown in figure 3.11.

Flux ref +
-
Table δ VSI induction
motor
T ref + wm
-

2T + w FLC δ' DT
T + 2w 1
δ
z -1
FLC ∆δ +
+ 2 +
-
z -1 z -1

model

Figure 3.11. Schematic of the Fuzzy Logic DTC. In dashed line is separated the
novel fuzzy controller part.

It should be clear that despite the fact that there are two Fuzzy Logic controllers, just one
fuzzy controller is used per iteration. Therefore, the computation capability of the real system
won't be necessarily that much.
It should be noted as well, that the schematic in figure 3.11 is pretty similar to the classical
DTC one in figure 2.2, including the motor model, which will calculate the torque, stator flux
modulus values and its position. However, the torque error is just given in two levels instead
of three. It means that from the classical DTC table II.II just four rows are used, being
discharged the null states. However, null states are introduced by means of the duty cycle.
Obviously, there is a novel part that corresponds to the novel Fuzzy Logic controller already
described. Finally this new controller will give a duty ratio value, which can be obtained by
means of two different ways. The first way is through the FLC1 (Fuzzy Logic controller 1).
This way will be the least used. The second way corresponds to the adaptive controller
thought to track the reference values. This other way gives an increment of the duty ratio,
which will be added to the previous duty ratio value.
The full system will work first as the classical DTC obtaining the active state through the
classical table. Then the fuzzy controller will give the duty ratio.

3.8
Fuzzy Logic Direct Torque Control.

3.2.4 - Stator Flux Reference Optimum Controller.


As it has been explained in the previous sections, the ripples in the electromagnetic torque and
stator flux are extremely reduced by using controllers based on Fuzzy Logic systems or
predictive methods. However, in order to obtain even a better reduction, stator flux reference
value has to be adapted to an optimum value, which should be just large enough to produce
the desired torque. The reason is that with this optimum value both the increase in the active
state is just large enough and the slight reduction in the null states is lower. Moreover, it is
achieved a reduction in the reactive power consumption taken from the mains supply.
The optimum expression, which gives the just large enough stator flux for the desired torque
is given in equation 2.23 from section 2.3.5.
In figure 3.12 can be seen the final Fuzzy Logic DTC schema with the stator flux reference
optimum controller. Notice how the optimum stator flux value is calculated from the torque
set point value.

optimum
+
flux -
Table δ VSI induction
motor
T ref +
- wm

2T + w FLC δ' DT
T+ 2w 1
δ
z -1
FLC ∆δ +
+ 2 +
-
z -1 z -1

model

Figure 3.12. Flux reference optimised controller in a Fuzzy Logic DTC.

3.9
Fuzzy Logic Direct Torque Control.

3.3 - Simulated results.

It is shown the simulation results per different working points, comparing the classical DTC
and the Fuzzy Logic DTC (FLDTC). More simulations than the ones shown have been done,
and the obtained results have been summarised in table III.I and table III.II.
In all simulations presented, it can be observed a much better behaviour of the FLDTC
performance, achieving one of the main objectives of the present work, which was to reduce
the torque ripple and consequently improve the motor performance.
A good adaptation of the FLC to any motor is proved since the simulation results are done for
two different motors, achieving in both cases a good response. These motors are the
"motor_1kW" and "motor_1.5kW". (All motors' details can be found in chapter 4).
An index error has been used to quantify the error in both the stator flux and torque responses.
This index is the integral of the square error (IE2), which is computed by means of the square
error instead of just the error; therefore, the more error is produced the more emphasis it is
given in the index.
All simulations have been realised with an ideal induction motor drive with no delays and the
sampling time (Tz) has been fixed to 100µs.

3.10
Fuzzy Logic Direct Torque Control.

16 16
wm wm
14 14
flux x 5 (Wb)

flux x 5 (Wb)
12 12
T* T
T* T
10 10
speed/10 (rd/s) torque (Nm)

speed/10 (rd/s) torque (Nm)


8 8

6 6

4 ψ∗ ψ 4 ψ∗ ψ

2 2

0 IE2 T =0.380 IE2 ψ=2.49e-3 0 IE2 T=0.738 IE2 ψ =2.57e-3

-2 -2
0 0.02 0.04 0.06 0.08 0.1 0 0.02 0.04 0.06 0.08 0.1
time (s) time (s)

Figure 3.13 A. Stator flux, torque and speed motor_1.5kW responses in Fuzzy Logic
DTC (left) and classical DTC (right). T=100%Tn . w m=100%wmn . Notice the IE2 flux
and torque error indexes values.

16 16
wm wm
flux x 10 (Wb)
flux x 10 (Wb)

14 14

12 12
ψ∗ ψ ψ∗ ψ
10 10
speed/10 (rd/s) torque (Nm)
speed/10 (rd/s) torque (Nm)

8 8

6 6
T* T
4 4 T* T
2 2

0 0
IE2 T =0.251 IE2 ψ =2.55e-3 IE2 T=0.297 IE2 ψ =2.46e-3
-2 -2
0 0.02 0.04 0.06 0.08 0.1 0 0.02 0.04 0.06 0.08 0.1
time (s) time (s)

Figure 3.13 B. Stator flux, torque and speed motor_1kW responses in Fuzzy Logic
DTC (left) and classical DTC (right). T=100%Tn . w m=100%wmn . Notice the IE2 flux
and torque error indexes values.

3.11
Fuzzy Logic Direct Torque Control.

16 16

14 wm
14 wm

flux x 10 (Wb)
flux x 10 (Wb)

12
12
ψ∗ ψ
10
10
8

speed (rd/s) torque (Nm)


speed (rd/s) torque (Nm)

8
6
6 T* T
4
4 ψ∗ ψ
2

2 T* T 0

0 -2
IE2 T=0.002 IE2 ψ =0.14e-3 IE2 T=0.160 IE2 ψ =6.46e-3

-2 -4
0 0.02 0.04 0.06 0.08 0.1 0 0.02 0.04 0.06 0.08 0.1
time (s) time (s)

Figure 3.14 A. Stator flux, torque and speed motor_1.5kW responses in Fuzzy Logic
DTC (left) and classical DTC (right). T=10%Tn . wm=10%wmn . Notice the IE2 flux
and torque error indexes values.

10 10
flux x 10 (Wb)

flux x 10 (Wb)

ψ∗ ψ
8 8

6 6
IE2T =1.35e-3 IE2 ψ=0.14e-3 IE2 T=0.0367 IE2 ψ =7.46e-3
speed/10 (rd/s) torque (Nm)
speed/10 (rd/s) torque (Nm)

4
4 ψ∗ ψ
T* T
2 wm 2 wm

0 T* T 0

-2 -2
0 0.02 0.04 0.06 0.08 0.1 0 0.02 0.04 0.06 0.08 0.1
time (s) time (s)

Figure 3.14 B. Stator flux, torque and speed motor_1kW responses in Fuzzy Logic
DTC (left) and classical DTC (right). T=10%Tn . wm=10%wmn . Notice the IE2 flux
and torque error indexes values.

3.12
Fuzzy Logic Direct Torque Control.

16 16
wm
wm
14 14
flux x 5 (Wb)

flux x 5 (Wb)
T* T
12 12
T* T
10 10
speed (rd/s) torque (Nm)

speed (rd/s) torque (Nm)


8 8

6 ψ∗ ψ 6 ψ∗ ψ

4 4

2 2

IE2 T=0.304 IE2 ψ =3.14e-3


0 0 IE2 T =0.418 IE2 ψ=2.88e-3

-2 -2
0 0.02 0.04 time (s) 0.06 0.08 0.1 0 0.02 0.04 time (s) 0.06 0.08 0.1

Figure 3.15 A. Stator flux, torque and speed motor_1.5kW responses in Fuzzy Logic
DTC (left) and classical DTC (right). T=100%Tn . w m=10%wmn . Notice the IE2 flux
and torque error indexes values.

10 10
flux x 10 (Wb)

flux x 10 (Wb)

9 9
ψ∗ ψ ψ∗ ψ
8 8
7 7
speed/10 (rd/s) torque (Nm)

6 6
speed/10 (rd/s) torque (Nm)

T* T
5 5 T* T
4 4

3 3

2 wm 2 wm
1 1
IE2 T=0.169 IE2 ψ =2.74e-3 IE2 T=0.189 IE2 ψ =2.53e-3
0 0
0 0.02 0.04 0.06 0.08 0.1 0 0.02 0.04 0.06 0.08 0.1
time (s) time (s)

Figure 3.15 B. Stator flux, torque and speed motor_1kW responses in Fuzzy Logic
DTC (left) and classical DTC (right). T=100%Tn . w m=10%wmn . Notice the IE2 flux
and torque error indexes values.

3.13
Fuzzy Logic Direct Torque Control.

10 10

9 9
ψ∗ ψ
flux x 10 (Wb)

flux x 10 (Wb)
8 wm 8 wm

7 7
ψ∗ ψ T* T
6 6
speed/10 (rd/s) torque (Nm)

speed/10 (rd/s) torque (Nm)


5 5
T* T
4 4

3 3

2 2
IE2 T=0.060 IE2 ψ =0.882e-3
1 1 IE2 T=0.224 IE2 ψ =3.08e-3

0 0
0 0.02 0.04 0.06 0.08 0.1 0 0.02 0.04 0.06 0.08 0.1
time (s) time (s)

Figure 3.16 A. Stator flux, torque and speed motor_1.5kW responses in Fuzzy Logic
DTC (left) and classical DTC (right). T=50%Tn . wm=50%wmn . Notice the IE2 flux
and torque error indexes values.

10 10
flux x 10 (Wb)

flux x 10 (Wb)

9 9
ψ∗ ψ
8 wm 8 wm
7 7
ψ∗ ψ
speed/10 (rd/s) torque (Nm)

6 6
speed/10 (rd/s) torque (Nm)

5 5
T* T
4 4
3 T* T 3
2 2
1 IE2 T=0.033 IE2 ψ=0.88e-3 1 IE2 T=0.068 IE2 ψ =2.57e-3
0 0
0 0.02 0.04 0.06 0.08 0.1 0 0.02 0.04 0.06 0.08 0.1
time (s)
time (s)

Figure 3.16 B. Stator flux, torque and speed motor_1kW responses in Fuzzy Logic
DTC (left) and classical DTC (right). T=50%Tn . wm=50%wmn . Notice the IE2 flux
and torque error indexes values.

3.14
Fuzzy Logic Direct Torque Control.

3.4 - Interim conclusions.

After all the research done in section 2.3, this thesis is focused on introducing a modulation in
the DTC. A Fuzzy Logic controller controls this modulation, between the selected active state
and a null one. Therefore, it has been suggested and deeply described the Fuzzy Logic
controller, which together with the DTC will create the Fuzzy Logic DTC. The Fuzzy Logic
controller designed is adaptive, improving even more the whole FLDTC.
Simulation results show the validity of the FLDTC method not only achieving a considerable
reduction in torque ripple, but also reducing the reactive power consumption taken from the
mains supply.
Simulated results corroborate all the presented work. Moreover, the simulations correspond to
two different motors being proved the validity of the FLDTC for any motor. It has been used
just one switching period (100µs) in all simulations, and no delays have been considered.
In table III.I is shown the error value index (IE2) obtained in the simulations per different
working points for the motor_1.5kW.
In table III.II is shown the error value index (IE2) obtained in the simulations per different
working points for the motor_1kW.
In both motors the results are pretty similar. Therefore, the first conclusion is that the Fuzzy
Logic controller works properly in any motor, thus the FLDTC is a good control method for
any motor.
From the tables III.I and III.II, it can be concluded:
§ IE2 in torque is always smaller in FLDTC than in classical DTC. Therefore, the validity
of FLDTC is corroborated.
§ IE2 in flux is nearly always smaller in FLDTC than in classical DTC. The smaller the
torque set point is the smaller flux FLDTC IE2 value is. However, there are just a few
exceptions when the torque set point is near to the nominal one. Under these
circumstances, both flux error indexes are pretty similar. The reason is that the stator flux
ripple is reduced by means of the stator flux reference optimum controller introduced in
section 2.3.5, that always works but when the torque set point is near to the nominal value.

3.15
Fuzzy Logic Direct Torque Control.

IE2 FLDTC c_DTC


Tpc Wpc Flux Torque Flux Torque
100% 10% 3.14e-3 0.30441 2.88e-3 0.4184
50% 50% 0.882e-3 0.06047 3.08e-3 0.2248
10% 10% 0.1494e-3 0.002641 6.46e-3 0.16093
100% 100% 2.49e-3 0.3806 2.57e-3 0.7385
100% 50% 2.61e-3 0.322 2.61e-3 0.499
50% 100% 0.86e-3 0.06832 2.60e-3 0.2557
75% 75% 1.635e-3 0.171 2.61e-3 0.383

Table III.I: Error index values (IE2) obtained form the motor_1.5kW
simulations per different working points. A comparison between the
classical DTC and the Fuzzy Logic DTC is done, not only for the torque
error values but also for the stator flux ones.

IE2 FLDTC c_DTC


Tpc Wpc Flux Torque Flux Torque
100% 10% 2.74e-3 0.169 2.53e-3 0.189
50% 50% 0.88e-3 0.033 2.57e-3 0.068
10% 10% 0.14e-3 0.00135 7.46e-3 0.0367
100% 100% 2.55e-3 0.251 2.46e-3 0.297

Table III.II: Error index values (IE2) obtained form the motor_1kW
simulations per different working points. A comparison between the
classical DTC and the Fuzzy Logic DTC is done, not only for the torque
error values but also for the stator flux ones.

3.16
CHAPTER 4.
DESIGN of EXPERIMENTAL INDUCTION MOTOR DRIVE
SYSTEM.

4.1 - Introduction.

In previous chapters it has been introduced the theoretical study of both the DTC and the
FLDTC. Also, these studies have been verified by means of simulations. Next chapter deals
with the implementation of both versions of Direct Torque Control. Previously, a drive
system has been firstly design and then used.
This chapter is focused on the architecture of the full drive system and the motor workbench,
being entirely described in detail its main features. Also, the present chapter deals with the
program tools and the organisation of the different tasks. (All programs are listed in section
A2).

4.1
Design of experimental induction motor drive system.

A brief description of the real implemented programs and its main routines are explained.
Finally, some DTC and FLDTC real simulations, which have been realised taking into
account the real drive with all its delays and the finally used sampling period (166µs), are
shown.

4.2
Design of experimental induction motor drive system.

4.2 - Induction motor drive architecture.

Figure 4.1 shows the workbench, which has been fully set up for the present thesis. All the
system drive has been specially developed not only for this thesis but also for any
implementation of further research in the topic of motor drives. Therefore, this workstation is
supposed to be very versatile as well as powerful [BED 2] [BED 3].

PC/C32

DPRAM
( 1K X 32 ) DAUGTHER
ISA MODULE
PC MEMORY (A/D 4X16)
INTERFACE

DSP
PC
TMS320C32
CONTROL
Tl wm
AND STATUS
REGISTERS
DSP induction DC
ISA LINK DIO 32 8bits VSI DT
PC I/O PORT motor generator
INTERFACE

Figure 4.1. Experimental workbench. Its processors are PC and DSP. Communications
between the drive and the PC/DSP are solved by means of 32 digital I/O lines and 4 ADC.
DC generator is used as a load.

The experimental workbench is formed by the following described elements:


§ Digital Signal Processor (DSP) TMS320C32. It is one of the processors that execute most
of the programs of the control algorithm. It has got a self called "daughter module" that is
composed by four analogue to digital converters of 16 bits, being its sampling frequency
50kHz. The processor has got as well an input/output board TTL of 32 bits. These two
boards make possible and easier the communication between the induction motor drive
and the DSP based processor system [LSI 1] [LSI 2] [LSI 3].
§ Personal Computer (PC). This is the other processor that executes program code as well. It
works as a host, not only due to the fact that it has inside all the DSP based boards, but
also because it allows the edition and compilation of DSP and PC programs, keeping all
the reference values and results in its memory.
§ Voltage Source Inverter based on Isolated Gate Bipolar Transistors. This device supplies
the induction motor generating a three phase voltage with variable both frequency and

4.3
Design of experimental induction motor drive system.

amplitude. Its main characteristics are its power that is 25kW and its maximum current
50A. It can be supplied in either 220 V or 380 V. There are the necessary protections such
as current limit, over temperature, over DC link voltage, and IGBT saturation.
§ Three-phase Induction motor_1kW. This machine was used for all the simulated results.
Its main characteristics are as follows:
Star: 380V/2.8A
Delta: 220V/4.7A
Nominal mechanical power: Pn = 1.35 CV = 993.6 W
Nominal angular speed: ωmn = 1420 r.p.m. = 148.6 rd/s
Pair of poles: P = 2
Efficency = 72%
cos(φ) = 0.75
TSTART
= 2.2
Tnom

TMAX
= 2.4
Tnom
Inertia moment: J = 0.006 kg·m2

In this section is being presented the values per phase obtained performing both no
load and locked rotor tests for the "T" induction steady state model.
Stator resistance: R1 = 7.13 Ω
Rotor resistance: R2 = 8.18 Ω
Magnetising inductance: Lm = 0.6040 H
Leakage inductance: L1 = L2 = 0.0301 H

Maximum and nominal values calculated using the identified parameters:


Nominal torque: Tn = 6.7 N·m
Shaft angular speed: ωmn = 1378.4 r.p.m. = 144.35 rd/s
Nominal slip: s = 8.1·10-2
RMS nominal magnetising current: Imn = 1.05 A
Start torque: TSTART = 12.46 N·m

4.4
Design of experimental induction motor drive system.

Maximum torque: TMAX = 16 N·m (at ωmMAX = 851.94 r.p.m.)


Maximum slip speed: sωsMAX = 135.73 rad/s
RMS maximum stator current: I1 = 6.87 A
§ Three-phase Induction motor_1.5kW. This machine not only has been used in all the
simulation results but also in the experimental ones. Therefore, all the control strategies
have been proved in this machine. This motor is mechanically jointed to the DC
servomotor. Its main characteristics are as follows:
Star: 380V / 3.5A
Delta: 220V / 6A
Nominal mechanical power: Pn = 1.5kW
Nominal angular speed: ωmn = 1450 r.p.m. = 151.8 rd/s
Pair of poles: P = 2
Efficency = 76.9%
cos(φ) = 0.8

In this section is being presented the values per phase obtained performing both no
load and locked rotor tests for the "T" steady state induction motor model.
Stator resistance: R1 = 4.3 Ω
Rotor resistance: R2 = 5.05 Ω
Magnetising inductance: Lm = 0.3056 H
Leakage inductance: L1 = L2 = 0.0146 H

Maximum and nominal values calculated using the identified parameters:


Nominal torque: Tn = 9.9 Nm
Shaft angular speed: ωmn = 1400 r.p.m. = 146.62 rd/s
Nominal slip: s = 6.67·10-2
§ Permanent magnet DC servomotor. Its shaft is mechanically jointed to the Induction
motor's one. Its function is to act as a mechanical load, changing the load torque to the
Induction motor. Its main characteristics are as follows:
Manufacturer: Control Techniques.

4.5
Design of experimental induction motor drive system.

Type: Matador DCM 9B 30/20.


Armature voltage: 200V.
Maximum stable armature current: 20A.
Maximum peak armature current: 90A.
Armature resistance (at 25 o C): 0.31W.
Armature inductance: 2.3mH.
Number of poles: 4.
Type of isolation: F (100o C temperature increment ).
Thermal time constant: 80minutes.
Maximum speed: 3000rpm.
Maximum stable torque: 11Nm.
Induced armature voltage: 57V/Krpm.
Torque constant at 25 o C: 0.55Nm/A( for ωm = 0 rd/s).
Rotor inertia: 10⋅10-3 kgm2 .
Weight: 22kg
§ Power Resistances. These resistances are electrically connected to the DC Generator
absorbing different currents and consequently changing the load torque.
§ Dynamometer. It gives a voltage proportional to the shaft speed. Its main characteristics
are as follows:
Manufacturer: Radio-Energie.
Model: RE.0444 N1S 0.06 EG
Induced voltage: 0.06V/rpm
Maximum current: 0.18A.
Maximum angular speed: 10000rpm.
§ Encoder. It is together with the DC motor. It supplies three signals and its complementary
ones. Two of them are a square signals with one quarter of period delay. The third one
gives one impulse each turn.
§ Adaptive Signal Board. These circuits adapt the motor currents and the speed signals to
the Analogue to Digital converters. There are some filters in order to reduce the noise
keeping its delay as small as possible [LSI 3].

4.6
Design of experimental induction motor drive system.

The system architecture based on two processors (see figure 4.1) allows the implementation
of complex algorithms and the modular programming of the system being possible to change
one processor program keeping the other. Both processors can perform the programs
independently, exchanging the data by means of a DPRAM, which is a Dual Port Random
Access Memory. One processor can interrupt the other. The PC can monitor the DSP by
means of the interface based in the ISA bus. [LSI 1]

4.7
Design of experimental induction motor drive system.

4.3 - Implementing DTC and FLDTC.

4.3.1 - Task distribution.


As it has been said previously, the system architecture allows the system to be reprogrammed
easily. Therefore, many tasks were changed and proved without modifying the others.
Figure 4.2 shows the full schematic of the FLDTC. All blocks inside the dashed line are the
ones corresponding to the fuzzy logic controllers. The PC performs some of these blocks. The
rest of the tasks are performed by the DSP, which are mainly the DTC itself including the
motor model and the consequent control of the real time.

Flux ref +
-
Selection induction
δ VSI
Table motor
T ref + wm
-

2T + w δ' DT
FLC 1
T + 2w
δ

+
- ∆δ
FLC 2 +
-1 +
z
-1
z

motor model

Figure 4.2. Schematic of the Fuzzy logic DTC. In dashed line is separated the novel fuzzy
controller part, which is partially performed by the PC. The DSP performs the rest of the
tasks controlling the real time.

It should be clear that despite the fact that there are two fuzzy logic controllers, just one fuzzy
controller is used per iteration. Therefore, the computation capability of the real system won't
be necessarily that much.

4.3.2 - Programming the system.


The DSP has been programmed using both C language and assembler. All the tasks, which its
execution time was critical, have been programmed in assembler. Also, tasks that configure
the DSP hardware and interfaces have been programmed in assembler.

4.8
Design of experimental induction motor drive system.

The compiler allows mixed C and assembler code. [TII 2] [TII 3] [TII 4].
PC has been programmed in C language, due to the fact that its tasks are not critical regarding
time [MAT 1]. The real time is performed by the DSP.
The DTC and the FLDTC close the loop each 166µs.

4.3.3 - Timing of the real implementation.


Once the real system is implemented, the first idea that must be taken into account is the delay
due to the non ideal behaviour of the whole system. The most significant delays are
introduced by the Analogue to Digital Converter (ADC) and the control algorithm. The ADC
sampling frequency has been set to 20kHz, being the period 50µs. In the c_DTC, as it can be
seen in figure 4.3, the control algorithm is divided into three routines. These three routines are
firstly attending the ADC interruption processing all the data, secondly the estimation of the
torque and flux values and finally the DTC itself. All these routines take around 30µs to be
executed. Therefore, there is a total delay of 80 µs from the sampled data to the action of
sending the new VSI state. Finally the data is saved in order to obtain the experimental
results.

sample i i+1

save
ADC Est DTC send data

50us 30us

166us

Figure 4.3. DTC timing. The DTC is executed each 166µs. There is a delay of 80µs
from the sampled data until the active state is sent.

In the FLDTC the timing, shown in figure 4.4, is pretty similar to the classical DTC, already
shown in figure 4.3. However, some differences are present, mainly due to the FLC. Then,
once the active new state is sent, the FLC starts being executed. Because some parts of this
controller are executed in the PC, the DSP waits until they are finished obtaining the duty
cycle. Once the duty cycle is obtained, the timer is programmed. All this process takes 50µs.

4.9
Design of experimental induction motor drive system.

Therefore, any duty cycle, which needs to change the active state before this time, is ignored.
Therefore, not all the duty cycles are possible, being the minimum duty cycle 50% and the
maximum 100%.

sample i i+1

save
ADC Est DTC send FLC wait ρ timer
data

50us 30us 50us

166us

Figure 4.4 . FLDTC timing. The FLDTC is executed each 166µs. There is a delay of
80µs from the sampled data until the active state is sent. The Fuzzy Logic Controller
needs 50µs to be calculated.

Seeing figures 4.3 and 4.4 the idea that both systems have the same delays in order to validate
the comparison should be clear.

4.10
Design of experimental induction motor drive system.

4.4 - Simulation of the real plant.

As it has been said in section 4.3.3, there are some limitations in the real plant. These
limitations were not taken into account in the whole theoretical study realised in chapter 3.
These limitations can be summarised as follows:
§ The sample time can not be as small as wanted. In the real plant it is 166µs.
§ There is a delay of 30µs due to the software time execution.
§ There is a delay of 50µs in the worst case due to the Analogue to digital conversion.
§ The duty cycle values are limited due to the delay in the FLC execution. The real values
are in the range of 50% up to 100%.
First three limitations are taken into account into the real simulation. It will be considered that
its effect is similar to having a sample time of 166µs+30µs+50µs, being equal to 246µs.
Therefore, the torque ripple is higher; in concrete is 246/100 times higher; that is to say 2.46.
All magnitudes related to the torque ripple should be pre scaled according to this factor.
Therefore, 2.46 will divide all torque error FLC inputs and the torque hysteresis value will be
2.46 times bigger.
Simulations shown from figure 4.5 to 4.9 are done under these real conditions. All them
should be compared with the experimental results obtained in chapter 5.

15 15
T* T
flux x (-1) (Wb)

T* T
flux x (-1) (Wb)

10 10

5 5
speed/(-10) (rd/s) torque (Nm)

speed/(-10) (rd/s) torque (Nm)

0 0

ψ∗ ψ ψ∗ ψ
-5 -5

-10 wm -10
wm

-15 -15
0 0.01 0.02 0.03 0.04 0.05 0 0.01 0.02 0.03 0.04 0.05
time (s)
time (s)

Figure 4.5. Stator flux, torque and speed motor_1.5kW responses in Fuzzy Logic
DTC (left) and classical DTC (right). Torque reference value is 9.8Nm, i.e.
T=100%Tn . Torque load is being fixed by connecting a 4 ohms resistor to the DC
generator. All real system limitations are taken into account.

4.11
Design of experimental induction motor drive system.

10 10
T* T T* T

flux x (-1) (Wb)


flux x (-1) (Wb)

8 8

6 6

4 4

2 2

speed/(-10) (rd/s) torque (Nm)


speed/(-10) (rd/s) torque (Nm)

0 0

-2 ψ∗ ψ -2
ψ∗ ψ
-4 -4

-6 -6 wm
-8 wm -8

-10 -10
0 0.01 0.02 0.03 0.04 0.05 0 0.01 0.02 0.03 0.04 0.05
time (s)
time (s)

Figure 4.6. Stator flux, torque and speed motor_1.5kW responses in Fuzzy Logic
DTC (left) and classical DTC (right). Torque reference value is 4.9Nm, i.e.
T=50%Tn . Torque load is being fixed by connecting a 4 ohms resistor to the DC
generator. All real system limitations are taken into account.

8 8

T* T
flux x (-1) (Wb)

flux x (-1) (Wb)

6 T* T 6

4 4
speed/(-10) (rd/s) torque (Nm)

speed/(-10) (rd/s) torque (Nm)

2 2

0 0

ψ∗ ψ
-2 -2

-4 wm -4
ψ∗ ψ wm

-6 -6
0 0.01 0.02 0.03 0.04 0.05 0.05 0.06 0.07 0.08 0.09 0.1
time (s) time (s)

Figure 4.7. Stator flux, torque and speed motor_1.5kW responses in Fuzzy Logic
DTC (left) and classical DTC (right). Torque reference value is 2.45Nm, i.e.
T=25%Tn . Torque load is being fixed by connecting a 4 ohms resistor to the DC
generator. All real system limitations are taken into account.

From now on, all real simulations and all experimental results are just done or obtained from
motor_1.5kW. From figures 4.5, 4.6 and 4.7 can be concluded that the FLDTC is still
working better than the classical DTC. Therefore, it is proved that the FLC can be adapted to
any plant with its own characteristics and limitations, keeping its good performance.
However, due to the limitations of the real system, both systems work worse when comparing
these results with the one obtained in section 3.3.

4.12
Design of experimental induction motor drive system.

10
isD isQ ψsD ψsQ ψ
ψ sD (Wb) ψ sQ (Wb) ψ (Wb) 8

-2

-4
isQ(A)

-6
(A)

-8
isD

-10
0.02 0.04 0.06 0.1 0.12 0.14
time (s)

Figure 4.8 . D and Q current components. D and Q flux components and its module.
All magnitudes correspond to the simulation realised in figure 4.6 right. That is to
say, classical DTC, Torque reference value 4.9Nm, i.e. T=50%Tn .

1.5
ψsD ψsQ ψ

1
ψ sD (Wb) ψ sQ (Wb) ψ (Wb)

0.5

-0.5

-1

-1.5
0 0.02 0.04 0.06 0.1 0.12 0.14 0.16
time (s)

Figure 4.9. Figure 4.8 vertical zoom.


D and Q stator flux components and its modulus value. Notice how once one
component is zero, the other is equal to the modulus

4.13
Design of experimental induction motor drive system.

4.5 - Interim conclusions.

This chapter has summarised the development of the equipment used for the experimental
three phase induction motor drive.
It has been presented a parallel processing architecture with two processors (PC, DSP)
running simultaneously. The DSP is based in the PC ISA bus, which gives a high immunity to
conducted and radiated interference. This architecture solves the data exchange between
processors and allows the experimentation of an AC motor control system with two
processors that can execute two different programs in parallel. Reprogramming the system is
considered to be one of the advantages of the system, because the changes in one processor
program do not affect to the other. Also, the system is capable of acquiring external signals
and of generating digital outputs signals [BED 2] [BED 3].
Finally, it has been pointed out the main problems due to the limitations of the real systems. It
has been suggested a way to overcome the mentioned limitations keeping the proper
performance of the system. Simulated results are shown to validate the work.

4.14
CHAPTER 5.
EXPERIMENTAL RESULTS.

5.1 - Corroborating the real implementation.

5.1.1 - Classical DTC.


All graphics of the present chapter correspond to the experimental results obtained from the
real plant just using the induction motor_1.5kW. In all cases, the reference values were as
follows:
§ Torque reference value = 4.9Nm. Torque hysteresis value = 1.3Nm.
§ Flux reference value = 1.15Wb. Flux hysteresis value =0.05Wb.
§ Sample time = Ts = Tz = 166µs.
All graphics try to show the correct behaviour of the classical DTC.

5.1
Experimental results

i sD isQ T
20
torque + 10 (Nm)

15

10

5
i (A)
sQ

0
is D (A)

-5

-10
0 100 200 300 400 500 600 700 800 900

n x Ts. Ts=166us

Figure 5.1. D and Q current components. Electromagnetic torque plus 10Nm.

Figure 5.2 should be compared with its simulated equivalent in figure 4.8. It can be said that
the simulation matches perfectly with the experimentation.

i sD i sQ ψsD ψsQ ψ
10
isD (A) isQ (A) ψ sD (Wb) ψ sQ (Wb) ψ (Wb)

-2

-4

-6

-8

-10
0 100 200 300 400 500 600 700 800 900

n x Ts. Ts=166us
Figure 5.2. D and Q current components. D and Q flux components and its module.

5.2
Experimental results

Figure 5.3 should be compared with its simulated equivalent in figure 4.9. Again the
simulated results are equal to the experimental ones.

1.5
ψsD ψsQ ψ

1
ψ sD (Wb) ψ sQ (Wb) ψ (Wb)

0.5

-0.5

-1

-1.5
0 50 100 150 200 250
n x Ts. Ts=166us

Figure 5.3. Figure 5.2 horizontal zoom of the samples 300 to 550.
D and Q stator flux components and its modulus value. Notice how once one
component is zero, the other is equal to the modulus.

1.5

0.5
ψ sQ (Wb)

-0.5

-1

-1.5
-1.5 -1 -0.5 0 0.5 1 1.5

ψ sD (Wb)
Figure 5.4. Stator flux. Notice how it follows a circular shape.

5.3
Experimental results
ψsD ψsQ ψ ψ−hst ψ+hst ψ_e
state sect T_e
2
(Wb) flux_hst_error torque_hst_error

0
sector*(-1) state*(-1)

-1

-2

-3

-4

-5
ψ

-6
0 50 100 150 200 250 300 350 400

n x Ts. Ts=166us

Figure 5.5 Flux and torque errors signals. Flux sector. Selected state and all the
inputs in its look up table, which are flux and torque errors signals and flux sector.
Moreover, it is shown D, Q, modulus and hysteresis limits, all magnitudes for the
stator flux.

ψs D ψs Q ψ ψ−hst ψ+hst ψ_e


state sect T_e
2
torque_hst_error

1
state*(-1)

-1
(Wb) flux_hst_error

sector*(-1)

-2

-3

-4
ψ

-5

-6
0 10 20 30 40 50 60 70 80 90 100
n x Ts. Ts=166us

Figure 5.6. Figure 5.5 horizontal zoom of the samples 0 to100.

5.4
Experimental results
ψsD ψsQ ψ ψ−hst ψ+hst ψ_e
state sect T_e
2

1
flux_hst_error torque_hst_error

-1
sector*(-1) state*(-1)

-2

-3

-4
(Wb)

-5
ψ

-6
1 2 3 4 5 6 7 8 9 10

n x Ts. Ts=166us
Figure 5.7. Figure 5.6 horizontal zoom of the samples 0 to10.
It can be deduced the correct behaviour of the look up table according to its inputs.
For instance, in the third sample the look up table inputs are: torque increase, flux
decrease and first sector. Therefore, the selected sate is the third.

ψ ψ +hst ψ−hst ψ_e T_e


2

1.8
flux_hst_error torque_hst_error

1.6

1.4

1.2

0.8

0.6
(Wb)

0.4
ψ

0.2

0
1 2 3 4 5 6 7 8 9 10
n x Ts. Ts=166us

Figure 5.8. Figure 5.7 vertical zoom. It is shown the correct behaviour of flux
hysteresis error value. For example, from samples 4 to 5, once the modulus
decreases under the negative hysteresis value, its error value changes from 0 to 1.

5.5
Experimental results
T T-hst T+hst T_e ψ_e state sect
15

10
torque+5 (Nm) flux_hst_error torque_hst_error
sector*(-1) state*(-1)

-5

-10
0 50 100 150 200 250 300 350 400

n x Ts. Ts=166us

Figure 5.9. Selected state, all look up table inputs (being flux and torque errors
signals and flux sector) and torque value plus 5 and its hysteresis limits plus 5.

T T-hst T+hst T_e ψ _e state sect


14

12
torque+5 (Nm) flux_hst_error torque_hst_error

10

8
sector*(-1) state*(-1)

-2

-4

-6
1 2 3 4 5 6 7 8 9 10
n x Ts. Ts=166us

Figure 5.10. Figure 5.9 horizontal zoom of the samples 20 to 30.


It can be deduced the correct behaviour of the look up table according to its inputs
and the torque hysteresis error signal. For example, from samples 2 to 4 the torque
increases crossing both hysteresis limits, changing from 2 to 1 and finally to 0 the
torque hysteresis error values. Of course, all selected states are the correct ones.

5.6
Experimental results

Figures 5.11 and 5.12 are shown in order to justify the validity of the torque values. If it is
considered the particular moment that the Q flux component is equal to zero, then the torque
expression is simplified as it is shown in equation 5.1.
T = P ⋅ c ⋅ (ψ sD ⋅ i sQ − ψ sQ ⋅ i sD ) ≅ 1.6 ⋅ ψ sD ⋅ i sQ (5.1)

is D is Q ψs D ψs Q T
10
torque (Nm)

6
(Wb)

2
ψ sQ

0
isD (A) i sQ (A) ψ sD (Wb)

-2

-4

-6

-8

-10
0 50 100 150 200 250 300
n x Ts. Ts=166us

Figure 5.11. D, Q flux and current components and torque value.

i sD isQ ψsD ψsQ T isD isQ ψsD ψsQ T


8 8
torque (Nm)

torque (Nm)

7
6
6
4
(Wb)

(Wb)

5
2
sQ

sQ

4
ψ

3 0
(Wb)

(Wb)

2
-2
sD

ψ sD
ψ

1
-4
(A)

(A)

0
i sQ

i sQ

-6
-1
(A)

(A)

-2 -8
i sD

i sD

1 2 3 4 n x 5Ts. Ts=166us
6 7 8 9 10 1 2 3 4 5 6 7 8 9 10
n x Ts. Ts=166us

Figure 5.12. Left: figure 5.11 horizontal zoom of the samples 20 to 30.
Right: figure 5.11 horizontal zoom of the samples 205 to 215.
In both cases Q flux component tends to zero. Therefore, the torque value is equal to
1.6 times the product of D flux component and Q current component. Considering
that the flux modulus is 1.15, the torque value is 1.84 the Q current component.

5.7
Experimental results

5.1.2 - Fuzzy Logic DTC.


All graphics of the present chapter correspond to the experimental results obtained from the
real plant. In all cases, the reference values were as follows:
Torque reference value = 1.9Nm. Torque hysteresis value = 1.3Nm
Flux hysteresis value = 0.05Wb
Sample time = Ts = Tz = 166µs.
The flux reference value is the optimum one obtained from equation 2.23.
All graphics show the correct behaviour of the FLDTC.

T EQ δ state sect
4

3
torque (Nm) equal duty_cycle sector*(-1) state*(-1)

-1

-2

-3

-4

-5

-6
0 50 100 150 200 250 300

n x Ts. Ts=166us

Figure 5.13. This graphic shows the excellent behaviour FLDTC. Notice how during
almost all sectors the active selected state is almost always the same, keeping the
torque ripple into a good value.

5.8
Experimental results

4
T EQ δ state sect

torque (Nm) equal duty_cycle sector*(-1) state*(-1) 3

-1

-2

-3

-4
0 2 4 6 8 10 12 14 16 18 20
n x Ts. Ts=166us

Figure 5.14. Figure 5.13 horizontal zoom of the samples 35 to 55.


The sector is always the third and the selected state is the fourth except in the sample
nine being the second. Once the selected state changes, the equal value changes
from one to zero switching the FLC from the adaptive to the non-adaptive one.

T EQ δ
2

1.5
torque (Nm) equal duty_cycle

0.5
1 2 3 4 5 6 7 8 9 10
n x Ts. Ts=166us

Figure 5.15. Figure 5.13 horizontal and vertical zoom of the samples 51 to 60.
It is shown the excellent behaviour of the adaptive FLC, modulating the duty cycle
value in order to keep the torque among its reference value.

5.9
Experimental results

5.2 - FLDTC and DTC comparison.

Results obtained from the reported investigation, when comparing the classical DTC drive
system with the novel FLDTC drive system, are illustrated from figure 5.16 to 5.25. Each
torque reference value has been applied to two different load conditions, being the resistance
values connected to the DC generator equal to 4 ohms and 8 ohms.
When the torque response characteristic for the two drive systems is compared, it can be seen
that the ripple in the torque characteristics is very much less for the novel FLDTC system than
for the classical DTC system for any torque reference value.
The torque ripple compared to the simulated results from chapter 3 is much bigger. This is
due to the following different reasons:
§ Simulations were done with a sample time equal to 100µs, meanwhile the real system
works at 166µs.
§ The real system has got an inherent delay of 80µs, meanwhile the simulations were done
without taking into account any delay.
§ Despite the fact that the controller should work properly for any sample time value, the
implemented controller was the optimum for 100µs as a sampling time and no delay,
being possible finding a more optimised FLC for the real plant conditions.
§ Due to the delays in executing the fuzzy controllers, the duty cycle can not take all the
possible values, being higher than 50%, as it is explain deeper in 4.3.3.
However, some simulations were done in section 4.4 taking into account all the previously
mentioned real limitations. These simulated results matches completely with the experimental
ones.

5.10
Experimental results

Figure 5.16 should be compared with its simulated equivalent in figure 4.5. It can be said that
the simulation matches perfectly with the experimentation due to the fact that the simulated
results did take into account all the real limitations.

15 15
T* T
T* T
(-1) (Wb)

(-1) (Wb)
10 10
x
flux

x
flux
5 5
speed/(-10) (rd/s) torque (Nm)

speed/(-10) (rd/s) torque (Nm)


ψ∗ ψ
0 0

ψ∗ ψ
-5 -5

-10 wm -10
wm

-15 -15
0 50 100 150 200 250 300 0 50 100 150 200 250 300
n x Ts. Ts=166us n x Ts. Ts=166us

Figure 5.16. Stator flux, torque and speed motor_1.5kW responses in Fuzzy Logic
DTC (left) and classical DTC (right).
Load resistance is 4Ω. Torque reference value is 9.8Nm, i.e. T=100%Tn .

15 15
T* T T* T
(-1) (Wb)

(-1) (Wb)

10 10
x

x
flux

flux

5 5
speed/(-10) (rd/s) torque (Nm)

speed/(-10) (rd/s) torque (Nm)

0 0

ψ∗ ψ
ψ∗ ψ
-5 -5

wm
-10 -10
wm

-15 -15
0 50 100 150 200 250 300 0 50 100 150 200 250 300
n x Ts. Ts=166us n x Ts. Ts=166us

Figure 5.17. Stator flux, torque and speed motor_1.5kW responses in Fuzzy Logic
DTC (left) and classical DTC (right).
Load resistance is 8Ω. Torque reference value is 9.8Nm, i.e. T=100%Tn .

5.11
Experimental results

15 15
(-1) (Wb)

T* T

(-1) (Wb)
T* T
10 10
x flux

x
flux
5 5
speed/(-10) (rd/s) torque (Nm)

speed/(-10) (rd/s) torque (Nm)


0 0

ψ∗ ψ ψ∗ ψ
-5 -5

wm
-10 -10

wm

-15 -15
0 50 100 150 200 250 300 0 50 100 150 200 250 300
n x Ts. Ts=166us n x Ts. Ts=166us

Figure 5.18. Stator flux, torque and speed motor_1.5kW responses in Fuzzy Logic
DTC (left) and classical DTC (right).
Load resistance is 4Ω. Torque reference value is 7.35Nm, i.e. T=75%Tn .

15
15
(-1) (Wb)

T* T T* T
(-1) (Wb)

10
10
x
x

flux
flux

5
5
speed/(-10) (rd/s) torque (Nm)
speed/(-10) (rd/s) torque (Nm)

0
0
ψ∗ ψ
ψ∗ ψ
-5
-5
wm
wm
-10
-10

-15
-15 0 50 100 150 200 250 300
0 50 100 150 200 250 300 n x Ts. Ts=166us
n x Ts. Ts=166us

Figure 5.19. Stator flux, torque and speed motor_1.5kW responses in Fuzzy Logic
DTC (left) and classical DTC (right).
Load resistance is 8Ω. Torque reference value is 9.8Nm, i.e. T=75%Tn .

5.12
Experimental results

Figure 5.20 should be compared with its simulated equivalent in figure 4.6. Again, the
simulated results match perfectly with the experimental ones.

10 10
T* T T* T
8

(-1) (Wb)
8
(-1) (Wb)

6 6

x
x

flux
4 4
flux

2 2

speed/(-10) (rd/s) torque (Nm)


speed/(-10) (rd/s) torque (Nm)

0 0

-2 ψ∗ ψ -2
ψ∗ ψ
-4 -4

-6 -6
wm
wm
-8 -8

-10 -10
0 50 100 150 200 250 300 0 50 100 150 200 250 300
n x Ts. Ts=166us n x Ts. Ts=166us

Figure 5.20. Stator flux, torque and speed motor_1.5kW responses in Fuzzy Logic
DTC (left) and classical DTC (right).
Load resistance is 4Ω. Torque reference value is 4.9Nm, i.e. T=50%Tn .

10 10
T* T T* T
(-1) (Wb)

(-1) (Wb)

8 8

6 6
x

x
flux

flux

4 4

2 2
speed/(-10) (rd/s) torque (Nm)

speed/(-10) (rd/s) torque (Nm)

0 0

-2 ψ∗ ψ -2
ψ∗ ψ
-4 -4

-6 -6
wm wm
-8 -8

-10 -10
0 50 100 150 200 250 300 0 50 100 150 200 250 300
n x Ts. Ts=166us n x Ts. Ts=166us

Figure 5.21. Stator flux, torque and speed motor_1.5kW responses in Fuzzy Logic
DTC (left) and classical DTC (right).
Load resistance is 8Ω. Torque reference value is 4.9Nm, i.e. T=50%Tn .

5.13
Experimental results

Figure 5.22 should be compared with its simulated equivalent in figure 4.7. It can be said that
the simulation matches perfectly with the experimentation due to the fact that the simulated
results took into account all the non-ideal limitations.

8 8
T* T
(-1) (Wb)

(-1) (Wb)
6 T* T 6
x

x
flux

4 4

flux
speed/(-10) (rd/s) torque (Nm)

2 2

speed/(-10) (rd/s) torque (Nm)


0 0
ψ∗ ψ
-2 -2 ψ∗ ψ

-4 wm -4 wm

-6 -6
0 50 100 150 200 250 300 0 50 100 150 200 250 300
n x Ts. Ts=166us n x Ts. Ts=166us

Figure 5.22. Stator flux, torque and speed motor_1.5kW responses in Fuzzy Logic
DTC (left) and classical DTC (right).
Load resistance is 4Ω. Torque reference value is 2.45Nm, i.e. T=25%Tn .

8 8
T* T
(-1) (Wb)
(-1) (Wb)

T* T
6 6
x
x

4 4
flux
flux

2 2
speed/(-10) (rd/s) torque (Nm)
speed/(-10) (rd/s) torque (Nm)

ψ∗ ψ
0 0

-2 -2

wm
-4 -4 wm ψ∗ ψ

-6 -6

-8 -8
0 50 100 150 200 250 300 0 50 100 150 200 250 300
n x Ts. Ts=166us n x Ts. Ts=166us

Figure 5.23. Stator flux, torque and speed motor_1.5kW responses in Fuzzy Logic
DTC (left) and classical DTC (right).
Load resistance is 8Ω. Torque reference value is 2.45Nm, i.e. T=25%Tn .

5.14
Experimental results

8 8

T* T
(-1) (Wb)

(-1) (Wb)
6 6
x

T* T
flux

x
4 4

flux
speed/(-10) (rd/s) torque (Nm)

2 2

speed/(-10) (rd/s) torque (Nm)


0 0
ψ∗ ψ
-2 -2

wm wm ψ∗ ψ
-4 -4

-6 -6
0 50 100 150 200 250 300 0 50 100 150 200 250 300
n x Ts. Ts=166us n x Ts. Ts=166us

Figure 5.24. Stator flux, torque and speed motor_1.5kW responses in Fuzzy Logic
DTC (left) and classical DTC (right).
Load resistance is 4Ω. Torque reference value is 1.9Nm, i.e. T=19%Tn .

8 8

T* T
(-1) (Wb)

(-1) (Wb)

6 T* T 6
x

x
flux

flux

4 4
speed/(-10) (rd/s) torque (Nm)

speed/(-10) (rd/s) torque (Nm)

2 2

0 0

ψ∗ ψ
-2 -2

wm
-4 -4 wm ψ∗ ψ

-6 -6
0 50 100 150 200 250 300 0 50 100 150 200 250 300
n x Ts. Ts=166us n x Ts. Ts=166us

Figure 5.25. Stator flux, torque and speed motor_1.5kW responses in Fuzzy Logic
DTC (left) and classical DTC (right).
Load resistance is 8Ω. Torque reference value is 1.9Nm, i.e. T=19%Tn .

5.15
Experimental results

5.3 - Interim conclusions.

In this chapter, the implementation of two high performance control strategies for three cage
rotor induction motors has been described. Being the first classical DTC and the second the
FLDTC, both with stator flux and torque estimation.
Experimental results are shown to analyse in detail the correct behaviour of both
implementations. All magnitudes evolution are analysed and justified.
Also, the main research point of the present thesis, which is the torque ripple reduction, has
been experimentally proved by means of the torque, flux and speed real experimental results.
Moreover, the adaptation of the ideal FLC not only to any motor but also to the limitations of
the real systems is corroborated.

5.16
CHAPTER 6.
CONCLUSIONS. FURTHER WORK.

6.1 - Conclusions.

6.1.1 - Direct Torque Control.


Direct Torque Control is supposed to be one of the best controllers for driving any induction
motor. Its main principles have been introduced and deeply explained. It is also demonstrated
in this thesis that the method of DTC also allows the independent and decoupled control of
motor torque and motor stator flux.
Two different estimators for the stator flux and torque have been fully developed.
It is also apparent from the investigation reported that DTC strategy is simpler to implement
than the flux vector control method because voltage modulators, and co-ordinate

6.1
Conclusions. Further work.

transformations are not required. Although, it introduces some disadvantages, being the
torque ripple one of the worst.
Four different methods for improving the classical DTC, which is the aim of the thesis, have
been studied and deeply discussed:
§ The first method is the search of a better look up table. After the research done in this
field, it can be concluded that by means of changing the table can not be remarkably
improved the DTC performance. However, some little improvements can be achieved.
Many conclusions have been obtained in this study, being the fundamental ideas for the
development of the most suitable Fuzzy Logic Controller.
§ The second method is the predictive one. It implies, not only the usage of Space Vector
Modulation, but also the calculation of the proper voltage reference. It has been concluded
that it is too complicated regarding its real implementation because of its calculus,
eliminating one of the DTC advantages, which is its simplicity.
§ The application of the Fuzzy Logic for implementing a simple modulation between the
selected active state and a null one, is the third method. It can be concluded that this
method is very promising. Therefore, the present thesis has been focused on that.
§ Finally, the fourth method is the regulation of the stator flux reference value. This method
can be applied in any motor drive. Not only it reduces the torque ripple improving the
motor performance, but also reduces the power reactive consumption taken from the
mains supply. Therefore, this method will be further considered.

6.1.2 - Fuzzy Logic Direct Torque Control.


After all the research done, this thesis is focused on introducing a modulation in the DTC. A
Fuzzy Logic Controller is in charge of controlling this modulation between the selected active
state and a null one. Therefore, it has been suggested and deeply described the Fuzzy Logic
Controller, which together with the DTC will create the Fuzzy Logic DTC. The FLC designed
is adaptive, improving even further the whole FLDTC. It has been deeply described and
justified its way of working, making emphasis on the fact that not only its inputs had to be the
torque errors and flux locus, but also the motor operating point. Moreover, the idea that this
fuzzy controller has to be adaptive has been taken into account.

6.2
Conclusions. Further work.

Simulation results show the validity of the FLDTC method not only achieving a considerable
reduction in torque ripple, but also reducing the energy consumption taken from the mains
supply.
Moreover, the simulations correspond to two different motors being proved the validity of the
FLDTC for any motor.
Firstly, all simulations have been obtained for an ideal generic plant, with sampling time
equal to 100µs and no delays. Once the experimental workbench was set up, its particular
parameters of sampling time and delay had been taken into account adapting the FLC. New
simulated results with the real plant have been obtained and presented, proving the adaptation
of the FLC to any plant, maintaining its good performance.

6.1.3 - Experimental motor drive system.


It has been set up versatile experimental equipment based on two processors, a PC and a DSP.
Its main characteristics are as follows:
§ The DSP is based in the ISA PC bus, being a good architecture to avoid any electro
magnetic interference.
§ Both processors can work independently. Therefore the system allows the parallel
processing. This parallel architecture has the following advantages:
§ It is a high computational capability system. DSP boards can be added, working all
them in parallel.
§ This architecture is currently quite common in industrial applications, giving the
possibility of testing the future real prototypes.
§ Communication between both processors is achieved easily through the Dual Port RAM.
Both processors can access this memory simultaneously, without interrupting the other.
§ Its program process can be modular, allowing the addition of new algorithms without
changing the other ones. It allows the possibility of an easy experimentation of new
algorithms.
§ The DSP can be easily programmed in both C language and assembler. Assembler has
been used in the critical real time tasks. All PC tasks have been programmed in C
language, due to the fact that they are not critical regarding the execution time.

6.3
Conclusions. Further work.

§ All experimental results are based in ASCII files, allowing the exportation to any
computer or workstation.

6.1.4 - Real implementation.


Experimental results, which match perfectly with the real simulations, have been obtained
showing the validity of the entire research. Therefore, the idea of reducing the torque ripple,
which is supposed to be one of the disadvantages of the classical DTC, by means of a fuzzy
logic modulation, has been experimentally corroborated.
The experimental results are divided into two groups. The first group shows the proper
behaviour of the classical DTC and FLDTC. In these graphics, it has been shown the
evolution of all magnitudes, even with a resolution equal to the sampling time (166µs). Using
the second group of experimental results, it has been done the comparison between the
classical DTC and the FLDTC for different motor working points. It has been proved how the
torque ripple is much lower in the FLDTC than in the classical DTC for any working points.
Moreover, the adaptation of the ideal FLC not only to any motor but also to the limitations of
the real system has been corroborated.

6.4
Conclusions. Further work.

6.2 - Further work.

All further work is summarised schematically in the following ideas:


§ Developments of new fuzzy controllers to achieve better performance. This new fuzzy
controller should, at least, take into account the following ideas:
§ Develop a completely auto adaptive controller.
§ The controller must be adaptive to any motor.
§ Try to overcome the electrical noises, which appears in any power drive.
§ Study the torque ripple reduction not only with fuzzy modulators but also with multilevel
converters.
§ Find optimum controllers, not only for torque ripple reductions, but also for reducing EMI
and for increasing energy savings form the mains.
§ Quantify the real savings of reactive power obtained from the optimised stator flux
reference value.
§ Sensorless FLDTC implementation, just sensing two currents and the DC voltage and by
means of either Kalman filter techniques or observers.
§ Study and apply different FLDTCs, not only to induction motors as it has been done in the
present thesis, but also to any electrical motor.

6.5
REFERENCES.

[ABB 1] ABB Sistemas Industriales, S.A. " Control Directo de Par", Technical Guide.

[ALF 1] Alfonso, D.; Gianluca, G.; Ignazio,M. ; Aldo, P. "An improved Look-up table for
Zero Speed Control in DTC Drives", Proceedings EPE'99, 8th European
Conference on Power Electronics and Applications. Lausanne. September /1999.

[ARI 1] Arias, A.; Romeral, J.L.; Bedford, D.; Aldabas, E "Hard-less Dead-time
Compensator for PWM Voltage Inverters", Proceedings IECON'98, 24th Annual
Conference of the IEEE Industrial Electronics Society. Aachen. Germany.
September 1998. Pages 780 - 785.

[ARI 2] Arias, A.; Romeral, J.L.; Aldabas, E.; Jayne, M.G. "Improving Direct Torque
Control by means of Fuzzy Logic". SAAEI'00, Seminario Anual de Automática,
Electrónica Industrial e Instrumentación, 2000. ISBN: 84-699-2994-1. September
2000. Pages 197 - 200.

[ARI 3] Arias, A.; Romeral, J.L.; Aldabas, E.; Jayne, M.G. "Fuzzy Logic Direct Torque
Control". ISIE'00. IEEE International Sypmposium on Industrial Electronics.
December 2000. Puebla. Mexico.

[ATT 1] Attaianese, C.; Nardi, V.; Prefetto, A.; Tomasso, G. "Vectorial Torque Control: A
Novel Approach to Torque and Flux Control of Induction Motor Drives" IEEE
Trans. on Industry Applications, Vol. 35, No. 6; November/December 1999,
pages 1399 - 1405.

[BED 1] Bedford, D.; Arias, A.; Aldabas, E.; Romeral, J. L." Sistema de Control Vectorial
Adaptativo de -Motores de Inducción basado en DSP ". SAAEI'97, Seminario
Anual de Automática, Electrónica Industrial e Instrumentación, 1997. ISBN: 84-
8498-451-6. Copiformes S.L./J.Dede. September 1997.

[BED 2] Bedford, D.; Arias, A.; Aldabas, E.; Romeral, J. L. “Parallel Processing AC Motor
Adaptive Vector Control System”. SAAEI'98, Seminario Anual de Automática,
Electrónica Industrial e Instrumentación, 1998. ISBN: 84-89654-11-5.
IBERDROLA INS. TEC. September 1998.

[BED 3] Bedford, D.; Arias, A.; Aldabas, E.; Romeral, J. L.” PC and DSP based AC motor
Adaptive Vector Control System”. Proceedings VECPAR'98, 3rd. International
Meeting on Vector and Parallel Processing. Porto (Portugal). June 1998.

R.1
References.

[BED 4] Bedford, D.; Romeral, J. L.; Arias, A.; Aldabas, E." Fuzzy Adaptive Speed
Controller without Reference Model". Proceedings EPE'99. 8th European
Conference on Power Electronics and Applications. ISBN: 90-75815-04-2.
September 1999. Lausanne (Switzerland).

[BED 5] Bedford, D.; "Control Vectorial Adaptativo de Motores Asíncronos de


Inducción". Doctoral Thesis. Univeritat Politècnica de Catalunya. October 1999.

[BIR 1] Bird, I. G,; Zelaya, H. " Fuzzy logic torque ripple reduction for DTC based AC
drives". Electronics Letters. 14th August 1997. Vol. 33. No.17.

[BLA 1] Blaschke, F. "The principle of Field Orientation applied to the new


TRANSVECTOR Close Loop Control Systems for rotating field machines";
Siemens Review, vol. 34, May 1972; pages 217 - 220

[BOL 1] Boldea, I.; Nasar, S.A. “Vector Control of AC Drives” CRC Press Inc., 1992.

[BOS 1] Bose, B. K.; "Power Electronics and AC Drives". Prentice-Hall. 1986.

[BOS 2] Bose, B. K.; Patel, N. P.; Rajashekara, K.; "A Neuro-Fuzzy based On-Line
Efficiency Optimization Control of a Stator Flux-Oriented Direct-Vector
Controlled Induction Motor Drive"; IEEE Trans. on Ind. Electronics, Vol. 44, vol.
2; Abril 1997, pages 270 – 273.

[BUJ 1] Buja, G.; Casadei, D.; Serra, G. "Direct Torque Control of Induction Motor
Drives". ISIE 97. Guimaraes. Portugal. IEEE Catalog Number: 97TH8280.

[BUJ 2] Buja, Giuseppe. "A New Control Strategy of the Induction Motor Drives: The
Direct Flux and Torque Control". IEEE Industrial Electronics Society Newsletter.
December 1998.

[CAS 1] Casadei, D.; Serra G.; Tani A.; "Improvement of Direct Torque Control
Performance by using a Discrete SVM Technique". ISBN 0-7803-4489-8. 1998
IEEE, pages 997 - 1003.

[CAS 2] Casadei, D.; Serra G.; Tani A.; "Implementation of a Direct Torque Control
Algorithm for Induction Motors Based on Discrete Space Vector Modulation";
IEEE Trans. on Power Electronics, Vol. 15, No. 4; July 2000, pages 769 – 777.

[GON 1] Gonzalez, D.; Llaquet, J.; Arias, A.; Bedford, D.; Romeral, J.L. Balcells, J.
"Improvement possibilities of PWM Voltage Inverter EMI effects using different
Modulations Methods". Proceedings EPE'99, 8th European Conference on Power
Electronics and Applications. ISBN: 90-75815-04-2. Lausanne. Switzerland.
September 1999.

R.2
References.

[HAB 1] Habelter, G.; Profumo, F.; Pastorelli, M.; Tolbert, L. "Direct Torque Control of
Induction Machines Using Space Vector Modulation"; IEEE Trans. on Industry
Applications, Vol. 28, No. 5; September/October 1992, pages 1045 – 1053.

[HIT 1] S. Hiti, ‘Modeling and Control of Three-Phase PWM Converters,’ Ph.D.


Dissertation, VPEC- Virginia Polytechnic Institute & State University, 1995.

[HOL 1] Holtz, J.; "Pulse width modulation - A survey"; IEEE Trans. on Industrial
Electronics, vol. 39. December 1992; pages 410 - 420.

[KAN 1] Kang, J.; Sul, S.; "New Direct Torque Control of Induction Motor for Minimum
Torque Ripple and Constant Switching Frequency" IEEE Trans. on Industry
Applications, Vol. 35, No. 5; September/October 1999, pages 1076 - 1082.

[KER 1] Kerkman, R. J.; Seibel, B. J.; Rowan, T. M.; Schlegel, D. W.; " A new flux and
stator resistance identifier for AC drive systems", IEEE Trans. on Industry
Applications, Vol. 32, No. 3; May/June 1996, pages 585 - 593.

[LAS 1] Lascu, C.; Boldea, I.; Blaabjerg, F. “A Modified Direct Torque Control for
Induction Motor Sensorless Drive", IEEE Trans. on Industry Applications, Vol.
36, No. 1; January/February 2000, pages 122-130.

[LEG 1] Leggate, D.; Kerkman, R. J.; “Pulse-Based Dead Time Compensator for PWM
Voltage Inverters", IEEE Trans. on Ind. Electronics, Vol. 44, No. 2; April 1997,
pages 191-197.

[LEO 1] Leonhard, W.; "Control of Electrical Drives". Springler-Verlag. 1990.

[LLA 1] LLaquet, J.; Arias, A.; Romeral, J.L.; Bedford, D. "EMI effects of Hard-less
Dead-time compensated PWM Voltage Inverter". Proceedings ICHQP'98. 8th
International Conference on Harmonics and Quality of Power October 1998,
pages 516 - 520.

[LSI 1] Loughborough Sound Images plc." PC/C32 Technical Reference Manual". Ver
1.03. August 1996.

[LSI 2] Loughborough Sound Images plc." PC/32 DIO. 32 Channel Digital I/O Board.
User Manual" Ver 1.01. December 1994.

[LSI 3] Loughborough Sound Images plc." AM/D16QS. Quad Channel ADC Daughter
Module. User Manual". Ver 1.00. June 1995.

[LUD 1] Ludtke, I. “ The Direct Control of Induction Motors”. Thesis. Department of


Electronics and Information Technology. University of Glamorgan. May 1998.

R.3
References.

[LUD 2] Ludtke, I.; Jayne M.G. “A comparative study of high performance speed control
strategies for voltage sourced PWM inverter fed induction motor drives”, Seventh
International Conference on electrical Machines and Drives, 11-13 September
1995, University of Durham, UK.

[LUD 3] Ludtke, I.; Arias, A.; Jayne M.G. “Improvement Direct Torque Control of
Induction Motors”, 8th European Conference on Power Electronics and
Applications. EPE'99. ISBN: 90-75815-04-2. September 1999. Lausanne.
Switzerland

[MAR 1] Martinez, L. " Historia de las máquinas eléctricas". Edicions UPC. Universitat
Politècnica de Catalunya. 1994.

[MAR 2] Martins, C. A.; Meynard, T. A.; Roboam, X.; Carvalho, A. S. “A predictive


sampling scale model for direct torque control of the induction machine fed by
multilevel voltage-source inverters”,The European Physical Journal Applied
Physics. EDP Sciences 1999.

[MAT 1] Mata, A. " Turbo C. Iniciación y programación avanzada". Paraninfo. Second


edition. 1991.

[MOH 1] Mohan, Undeland, Robbins. " Power Electronics". Wiley. Second edition. 1989.

[NAS 1] Nash, J.; "Direct Torque Control, Induction Motor Vector Control without an
Encoder", IEEE Trans. on Ind. Applications, Vol. 33, No. 2; March/April 1997,
pages 333 - 341.

[NIE 1] Niemelä, M.; Pyrhönen, J.; Pyrhönen, O.; Luukko J. "Drift correction methods of
the stator flux linkage in DTC synchronous motor drives", Proceedings EPE'99,
8th European Conference on Power Electronics and Applications. Lausanne.
September/1999.

[NOG 1] Noguchi, T.; Yamamoto, M.; Kondo, S.; Takahashi, I. " Enlarging Switching
Frequency in Direct Torque-Controlled Inverter by Means of Dithering". IEEE
Trans. on Industry. Applications, Vol. 35, No. 6; November/December 1999;
pages 1358 - 1366.

[PYR 1] Pyrhönen, J.; Pyrhönen, O.; Niemelä, M.; Luukko J. "A Direct Torque Controlled
synchronous motor drive concept for dynamically demanding applications",
Proceedings EPE'99, 8th European Conference on Power Electronics and
Applications. Lausanne. September/1999.

[RAH 1] Rahman, M. A.; Radwan, T. S.; Osheiba, A. M.; Lashine, A. E.; "Analysis of
Current Controllers for Voltage Source Inverters", IEEE Trans. on Ind.
Electronics, Vol. 44, No 4; August 1997; pages 477 - 485

R.4
References.

[ROM 1] Romeral, J. L.; "Optimización de Modelos de Control Digital para Motores AC",
Doctoral Thesis, Universitat Politècnica de Catalunya. June 1995.

[ROM 2] Romeral, J. L.; Bordonau, J.; Bedford, D.; Aldabas, E.; "Adaptive fuzzy speed
controller for an AC drive", The 1st International Congress on Energy, Power &
Motion Control, Tel-Aviv; May 1997, pages 82 - 87.

[ROM 3] Romeral, J. L.; Aldabas, E.; Arias, A.; Llaquet, J. " Regulador Difuso Adaptativo
por variación de las Funciones de Pertenencia ", Actas SAAEI'00. Sem. Anual de
Automática, Electrónica Ind. e Instrumentación, 2000. ISBN: 84-699-2994-1.
Terrassa. September 2000, pages 273 - 276.

[ROM 4] Romeral, J.L.; Aldabas, E.; Arias, A.; LLaquet, J. "A Simple Self-Tuning PID
Speed Controller". ISIE'00. IEEE International Sypmposium on Industrial
Electronics. December 2000. Puebla. Mexico.

[SEP 1] Sepe, R. B.; Lang, J. H.; "Inverter non linearities and discrete Dead Time
Compensation", IEEE Trans. on Power Electronics. Vol. 8, Num. 4. October 1993.

[TAK 1] Takahashi, I and Nogushi, T. “A New Quick-Response and High-Efficiency


Control Strategy of an Induction Motor”, IEEE Trans. Industry Applications, Vol.
1A-22, pages 820-827, October 1986.

[TAK 2] Takahashi, I and Ohimori, Y. “High-Performance Direct Torque Control of an


Induction Motor”, IEEE Trans. Industry Applications, Vol. 25, pages 257-264,
March 1989.

[TII 1] Tiitine, P.; Pohjalainen, P.; Lalu, J.; "The next generation motor control method -
Direct Torque Control, DTC", Proc. EPE Chapter Symp., Lausanne, Switzerland,
1994.

[TII 2] Texas Instruments Incorporated." TMS320C3x User's Guide". October 1994.

[TII 3] Texas Instruments Incorporated." TMS320C3x Floating-Point DSP Optimizing C


Compiler, User's Guide ". February 1995.

[TII 4] Texas Instruments Incorporated." TMS320C3x Floating-Point DSP Assembly


Language Tools, User's Guide ". February 1995.

[VAS 1] Vas, P. " Electrical machines and drives: a space-vector theory approach". Oxford
University Press 1992.

[VAS 2] Vas, P. " Sensor less Vector and Direct Torque Control". Oxford University Press
1998.

R.5
References.

[VAS 3] Vas, P. "Artificial-Intelligence-Based Electrical Machines and Drives. Application


of Fuzzy, Neural, Fuzzy-Neural, and Genetic-Algorithm-Based Techniques".
Oxford University Press 1999.

[YAM 1] Yamamura, S.; " AC Motors for high-performance applications. Analysis and
Control". Ed. Marcel Dekka, Inc., 1986.

R.6
APPENDIXES.

A.1 - Programs.

In this section four programs are being listed:


§ TH1_5c.c. This program executes the classical DTC. It is sent to the DSP and executed by
it. Figure 4.3 in chapter 4 shows in detail its main functions.
§ PCTH1_5c.c. The PC executes this program. It sends the th1_5c.c file to the DSP in order
to perform the classical DTC. All data from the th1_5c.c is stored in the PC.
§ TH1_9.c. This program executes the Fuzzy Logic DTC. It is sent to the DSP and executed
by it. Figure 4.4 in chapter 4 shows in detail its main functions.
§ PCTH1_9.c. This program is executed by the PC. It sends the th1_9.c file to the DSP in
order to perform the Fuzzy Logic DTC. All data from the th1_9.c is stored in the PC.
Also, the PC helps in the execution of the Fuzzy Logic controllers.

A.1
Appendixes.

A.1.1 - TH1_5c.c.

/* File : TH1_5C.C */
/* Description: DSP program that performs:
1/program the adquisition boards AM/D16QS + AM/D16SA
2/run the flux and torque estimator each 166us saving the data in the DPRAM
3/ Classical DTC. ATN table.
/*_______________________________________________________________________*/

#include <c:\proves\math.h>

/* DPRAM Positions */
#define posicio_memoria_FLAG 0x0c00009 /*Flag*/
#define posicio_memoria_mfs_hst 0x0c0000b /* DTC references values */
#define posicio_memoria_te_hst 0x0c0000c /* " */
#define posicio_memoria_mfs_set 0x0c0000d /* " */
#define posicio_memoria_te_set 0x0c0000e /* " */
#define posicio_memoria_STOP 0x0c00012 /*Stop bit*/

#define posicio_memoria_f0 0x0c00048


#define posicio_memoria_f1 0x0c00049
#define posicio_memoria_f2 0x0c0004a
#define posicio_memoria_f3 0x0c0004b
#define posicio_memoria_f4 0x0c0004c
#define posicio_memoria_f5 0x0c0004d
#define posicio_memoria_f6 0x0c0004e
#define posicio_memoria_f7 0x0c0004f
#define posicio_memoria_f8 0x0c00050
#define posicio_memoria_f9 0x0c00051
/*10*/
#define posicio_memoria_fa 0x0c00052
#define posicio_memoria_fb 0x0c00053
#define posicio_memoria_fc 0x0c00054
#define posicio_memoria_fd 0x0c00055
#define posicio_memoria_fe 0x0c00056
#define posicio_memoria_ff 0x0c00057
#define posicio_memoria_f10 0x0c00058
#define posicio_memoria_f11 0x0c00059
#define posicio_memoria_f12 0x0c0005a
#define posicio_memoria_f13 0x0c0005b
/*20*/
#define posicio_memoria_f14 0x0c0005c
#define posicio_memoria_f15 0x0c0005d
#define posicio_memoria_f16 0x0c0005e
#define posicio_memoria_f17 0x0c0005f
#define posicio_memoria_f18 0x0c00060
#define posicio_memoria_f19 0x0c00061
#define posicio_memoria_f1a 0x0c00062
#define posicio_memoria_f1b 0x0c00063
#define posicio_memoria_f1c 0x0c00064
#define posicio_memoria_f1d 0x0c00065

A.2
Appendixes.

/*30*/
#define posicio_memoria_f1e 0x0c00066
#define posicio_memoria_f1f 0x0c00067
#define posicio_memoria_f20 0x0c00068
#define posicio_memoria_f21 0x0c00069
#define posicio_memoria_f22 0x0c0006a
#define posicio_memoria_f23 0x0c0006b
#define posicio_memoria_f24 0x0c0006c
#define posicio_memoria_f25 0x0c0006d
#define posicio_memoria_f26 0x0c0006e
#define posicio_memoria_f27 0x0c0006f
/*40*/
#define posicio_memoria_f28 0x0c00070
#define posicio_memoria_f29 0x0c00071
#define posicio_memoria_f2a 0x0c00072
#define posicio_memoria_f2b 0x0c00073
#define posicio_memoria_f2c 0x0c00074
#define posicio_memoria_f2d 0x0c00075
#define posicio_memoria_f2e 0x0c00076
#define posicio_memoria_f2f 0x0c00077

#define PI 3.141592654

asm(" .data");

/* DIO32 config. register */

asm("COUNTDPRAM .long 0c00016h");

/* 4 analog channels addresses*/

/* #define posicio_DIO 0828000 */


asm("posicio_DIO .long 00828000h");
asm("posicio_DIO2 .long 00828002h");
asm("posicio_DIO3 .long 00828004h");
asm("posicio_DIO4 .long 00828006h");

/* #define PORTREG 00828007 */


asm("PORTREG .long 00828007h");
/* DIO32 control register address */
/* #define CONTROL 00828005 */
asm("CONTROL .long 00828005h");

asm("dio1 .long 00ff0000h");


asm("pointerdio .long dio1");

asm("STR0A .word 00808064h");


asm("STR0D .word 004F0900h");
asm("STR1A .word 00808068h");
asm("STR1D .word 00070900h");
asm("IOSTRA .word 00808060h");
asm("IOSTRD .word 00000000h");

asm("AMELIA0 .word 0081A000h");

A.3
Appendixes.

asm("ITTP .word 06000000h");

asm("Mascara .word 0000ffffh");

/* Map AMELIA2 values / registers */

asm("DR3 .equ 01h");


asm("DR0 .equ 02h");
asm("DR2 .equ 03h");
asm("TMR0 .equ 04h");
asm("TMR1 .equ 05h");
asm("DR1 .equ 06h");
asm("IMR .equ 07h");
asm("CTR .equ 08h");
asm("ECTR .equ 09h");
asm("SMR .equ 0ah");
asm("CMR .equ 0ah");
asm("ISR .equ 0bh");
asm("DCR .equ 0ch");
asm("SDC .equ 0dh");
asm("ECFR .equ 0eh");
asm("CFR .equ 0fh");
/* Map AMELIA2 registers */

asm("TIMER1 .word 81B005h");


asm("UCR .word 81B008h");
asm("ACR .word 81B00Ah");
asm("CONFIG .word 81B00Fh");
asm("IMR1 .word 81B00Bh");
asm("DCR1 .word 81B00Ch");
asm("CH0 .word 81B002h");
asm("CH1 .word 81B006h");

/* Constants */
asm("IMR1_DEF .word 000010000h");
asm("DCR1_DEF .word 0001e0000h");
asm("TIMER1_DEF .word 0fd9b0000h");
asm("UCR_DEF .word 0a4000000h");
asm("ACR_DEF .word 000f20000h");
asm("CONFIG_DEF .word 08dff0000h");

/*Program section called 'int0X' where the interruprion vector is placed */


/*c_int0X is the name of the rotuine address */

asm(" .sect \".int01\"");


asm(" .word _c_int01");

asm(" .sect \".int02\"");


asm(" .word _c_int02");

asm(" .sect \".int05\"");


asm(" .word _c_int05");

A.4
Appendixes.

/* End int section */

asm(" .text");

/* pointers */
long * pointer_FLAG=(long *)posicio_memoria_FLAG;
float * pointer_mfs_set=(float *)posicio_memoria_mfs_set;
float * pointer_te_set=(float *)posicio_memoria_te_set;
float * pointer_mfs_hst=(float *)posicio_memoria_mfs_hst;
float * pointer_te_hst=(float *)posicio_memoria_te_hst;
long * pointerSTOP=(long *)posicio_memoria_STOP;

float * pointerf0=(float *)posicio_memoria_f0;


float * pointerf1=(float *)posicio_memoria_f1;
float * pointerf2=(float *)posicio_memoria_f2;
float * pointerf3=(float *)posicio_memoria_f3;
float * pointerf4=(float *)posicio_memoria_f4;
float * pointerf5=(float *)posicio_memoria_f5;
float * pointerf6=(float *)posicio_memoria_f6;
float * pointerf7=(float *)posicio_memoria_f7;
float * pointerf8=(float *)posicio_memoria_f8;
float * pointerf9=(float *)posicio_memoria_f9;
/*10*/
float * pointerfa=(float *)posicio_memoria_fa;
float * pointerfb=(float *)posicio_memoria_fb;
float * pointerfc=(float *)posicio_memoria_fc;
float * pointerfd=(float *)posicio_memoria_fd;
float * pointerfe=(float *)posicio_memoria_fe;
float * pointerff=(float *)posicio_memoria_ff;
float * pointerf10=(float *)posicio_memoria_f10;
float * pointerf11=(float *)posicio_memoria_f11;
float * pointerf12=(float *)posicio_memoria_f12;
float * pointerf13=(float *)posicio_memoria_f13;
/*20*/
float * pointerf14=(float *)posicio_memoria_f14;
float * pointerf15=(float *)posicio_memoria_f15;
float * pointerf16=(float *)posicio_memoria_f16;
float * pointerf17=(float *)posicio_memoria_f17;
float * pointerf18=(float *)posicio_memoria_f18;
float * pointerf19=(float *)posicio_memoria_f19;
float * pointerf1a=(float *)posicio_memoria_f1a;
float * pointerf1b=(float *)posicio_memoria_f1b;
float * pointerf1c=(float *)posicio_memoria_f1c;
float * pointerf1d=(float *)posicio_memoria_f1d;
/*30*/
float * pointerf1e=(float *)posicio_memoria_f1e;
float * pointerf1f=(float *)posicio_memoria_f1f;
float * pointerf20=(float *)posicio_memoria_f20;
float * pointerf21=(float *)posicio_memoria_f21;
float * pointerf22=(float *)posicio_memoria_f22;
float * pointerf23=(float *)posicio_memoria_f23;
float * pointerf24=(float *)posicio_memoria_f24;
float * pointerf25=(float *)posicio_memoria_f25;
float * pointerf26=(float *)posicio_memoria_f26;
float * pointerf27=(float *)posicio_memoria_f27;

A.5
Appendixes.

/*40*/
float * pointerf28=(float *)posicio_memoria_f28;
float * pointerf29=(float *)posicio_memoria_f29;
float * pointerf2a=(float *)posicio_memoria_f2a;
float * pointerf2b=(float *)posicio_memoria_f2b;
float * pointerf2c=(float *)posicio_memoria_f2c;
float * pointerf2d=(float *)posicio_memoria_f2d;
float * pointerf2e=(float *)posicio_memoria_f2e;
float * pointerf2f=(float *)posicio_memoria_f2f;

int d=0,STOP=0,FLAG=0;
/*DTC varialbes*/
int e1=0x95,e2=0x95,e7=0x95,e0=0xaa;
int e1_b=0;
int e_fi_ti=0xaa,e_fd_ti=0xaa,e_fi_td=0xaa,e_fd_td=0xaa;
int e_fd_td_b=0,e_fi_ti_b=0,e_fd_ti_b=0,e_fi_td_b=0;

int te_e=0,mfs_e=0;
float te_plim=0,te_nlim=0,mfs_plim=0,mfs_nlim=0,te_hst=0,mfs_hst=0;
float mfs_set=0,te_set=0;

/* adquisition variables*/
long int ch0=0,ch1=0,ch2=0;
long int *pch0=&ch0,*pch1=&ch1,*pch2=&ch2;
float ch0_float=0,ch1_float=1,ch2_float=0;

/* estimator zoh variables */


float isD=0,isQ=0,frD=0,frQ=0,fsD=0,fsQ=0,mfs=0,te=0,ang=0,sect=0;
float frD_1=0,frQ_1=0,isD_1=0,isQ_1=0;
float wrrds=0,wrrds_1=0,wrrds_2=0,wrrds_3=0,wrrds_4=0;
float sectbis_aux=0,angbisfloat=0;
int sectbis=0;
float etz2_5=0.9960652825,etz1_6=0.9973751317;
float Rr=5.05,Lm=0.30563,P=2,Lr=0.32023;
float Lx=0.0091376,c=0.816496,stz=0;
int x=0;
double angbis=0,table[402];

/* functions */
void c_int01(void); /* Amelia int */
void c_int02(void); /* Amelia int */
void c_int05(void); /* Control */
void set_amd16qs(void); /* ADC inizialization */
void set_amd16sa(void); /* ADC inizialization */
void dio32(void); /* DIO inizialization */
void atn_table (void); /* ATN table */
void get_ADC(void); /* read 2 currents + wm */
void flux_torque_est_zoh(void); /* Flux and torque estimation zoh
*/
void dtc(void); /* dtc */
void save_data_DPRAM(void);
/*void save_data_DPRAM_2(void);*/
void send_active_state(void); /* send the active state */
void save_active_state(void); /* save the active state */
void bit1(void);
void bit0(void);

A.6
Appendixes.

/************************************************************************/
/* Function : main
*/
/************************************************************************/
void main(void)
{

asm(" LDP STR0A,DP");


asm(" LDP @STR0A,AR0");
asm(" LDP @STR0D,R0");
asm(" STI R0,*AR0");

asm(" LDP STR1A,AR0");


asm(" LDP STR1D,R0");
asm(" STI R0,*AR0");

asm(" LDP IOSTRA,AR0");


asm(" LDP IOSTRD,R0");
asm(" STI R0,*AR0");

dio32();

/* null state to VSI */

do {
STOP=*pointerSTOP;
}
while (STOP==1);

if (STOP ==0)
{ atn_table();
/* getting the reference values */
mfs_set=*pointer_mfs_set;
te_set=*pointer_te_set;
mfs_hst=*pointer_mfs_hst;
te_hst=*pointer_te_hst;
mfs_plim=mfs_set+mfs_hst;
mfs_nlim=mfs_set-mfs_hst;
te_plim=te_set+te_hst;
te_nlim=te_set-te_hst;

set_amd16qs();
set_amd16sa();

asm(" LDI @ITTP,IF");

/* Enalbing interruptions INT0 +INT1 + INT5 of PC/C32 board */


asm(" LDI 0013h,IE");
/* Globals int enable */
asm(" OR 2000h,ST");
/* Start Cache */
asm(" OR 0800h,ST");

A.7
Appendixes.

do {
STOP=*pointerSTOP;
}
while (STOP==0);

/* Disable int */

asm(" AND 0000h,IE");


asm(" AND 0000h,ST");

asm(" LDI 00ffh,R1");


asm(" LSH 16,R1");
asm(" LDI @posicio_DIO,AR1");
asm(" STI R1,*AR1");

}
/************************************************************************/
/* End Function : main */
/************************************************************************/

/************************************************************************/
/* Function : c_int01 */
/* AMELIA2_A interruption */
/************************************************************************/
void c_int01(void)
{
asm(" PUSH AR0");
asm(" PUSH AR2");
asm(" PUSH R0");

/* disable int*/
asm(" ANDN 2000h,ST");

asm(" LDI @AMELIA0,AR0");


asm(" LDI *+AR0(ISR),R0");

asm(" LDI *+AR0(DR0),R0");


asm(" LDI *+AR0(DR1),R0");
asm(" LDI *+AR0(DR2),R0");
asm(" LDI *+AR0(DR3),R0");

asm(" LDI *+AR0(DR0),R0");


asm(" LDI *+AR0(DR1),R0");
asm(" LDI *+AR0(DR2),R0");
asm(" LDI *+AR0(DR3),R0");

asm(" LDI *+AR0(DR0),R0");


asm(" LDI *+AR0(DR1),R0");
asm(" LDI *+AR0(DR2),R0");
asm(" LDI *+AR0(DR3),R0");

asm(" LDI *+AR0(DR0),R0");


asm(" LDI *+AR0(DR1),R0");
asm(" LDI *+AR0(DR2),R0");
asm(" ASH -16,R0");
asm(" LDI @_pch2,AR2");

A.8
Appendixes.

asm(" STI R0,*AR2");


asm(" LDI *+AR0(DR3),R0");

/* int 05 is set*/
asm(" OR 010h,IF");

asm(" POP R0");


asm(" POP AR2");
asm(" POP AR0");
/* erase this interrupt flag */
asm(" ANDN 1h,IF");

}
/************************************************************************/
/* End Function : c_int01 */
/************************************************************************/

/************************************************************************/
/* Function : c_int02 */
/* AMELIA2_B int */
/************************************************************************/
void c_int02(void)
{
asm(" PUSH AR0");
asm(" PUSH AR1");
asm(" PUSH AR2");
asm(" PUSH R0");
asm(" PUSH R1");
/* disable int*/
asm(" ANDN 2000h,ST");

asm(" LDI @IMR1,AR0");


asm(" LDI *AR0,R0");

asm(" LDI @CH0,AR0");


asm(" LDI @CH1,AR1");
asm(" LDI *AR0,R0");
asm(" LDI *AR1,R1");
asm(" ASH -16,R0");
asm(" LDI @_pch0,AR2");
asm(" STI R0,*AR2");
asm(" ASH -16,R1");
asm(" LDI @_pch1,AR2");
asm(" STI R1,*AR2");

asm(" POP R1");


asm(" POP R0");
asm(" POP AR2");
asm(" POP AR1");
asm(" POP AR0");

/* erase this interrupt flag */


asm(" ANDN 2h,IF");

}
/************************************************************************/

A.9
Appendixes.

/* End Function : c_int02 */


/************************************************************************/

/************************************************************************/
/* Funcio : c_int05 (166us)
/************************************************************************/
void c_int05(void)
{
bit1();
get_ADC();
flux_torque_est_zoh();
dtc();
/* bit0();*/
/* for(d=0;d<215;d++)
{
}
d=0;*/
send_active_state();
bit0();
save_data_DPRAM();
/* save_data_DPRAM_2();*/

}
/************************************************************************/
/* End Function : c_int05 (166us)
*/
/************************************************************************/

/************************************************************************/
/* Function : get_ADC (estimator)
/************************************************************************/
void get_ADC (void)
{
/* disable int*/
asm(" ANDN 2000h,ST");

/* get isA,isB,wm */

/* 65535 / 6volts ; 1volt / 7.0922 amp */


/* ch0_float=-(1.0*ch0*9.155273438e-5*7.1*1.03*6.11/7)+3.5e-3;
ch1_float=-(1.0*ch1*9.155273438e-5*7.1*1.015*6.11/7)-3.0e-2;*/

/* 65535 / 6volts ; 1volt / 10 amp */


/* LEM probe */
ch0_float=-(1.0*ch0*9.155273438e-5*10*4.85/5.15);
/* Tektronic Probe */
ch1_float=-(1.0*ch1*9.155273438e-5*10);

/* 65535 / 4volts ; 6e-2volts / 1rpm */


ch2_float=-(1.0*(ch2-170.5)*6.103515625e-5/(1.10965*6e-4));

/* enalbe global int*/


asm(" OR 2000h,ST");
}
/************************************************************************/
/* Funcio : get_ADC (estimator) */

A.10
Appendixes.

/************************************************************************/
/************************************************************************/
/* Function : flux_torque_est_zoh */
/************************************************************************/
void flux_torque_est_zoh(void)
{ double sqr=0;
float aux=0;
int index=0;

frD_1=frD;
frQ_1=frQ;
wrrds_4=wrrds_3;
wrrds_3=wrrds_2;
wrrds_2=wrrds_1;
wrrds_1=wrrds;
isD_1=isD;
isQ_1=isQ;

isD=1.2247*ch0_float;
/* isQ=0.95*(1.4142135*ch1_float)+(0.7071067*ch0_float);*/
isQ=(1.3435028*ch1_float)+(0.7071067*ch0_float);
/* wrrds=(wrrds_4+wrrds_3+wrrds_2+wrrds_1+(2*PI/60*ch2_float))/5;*/
wrrds=(wrrds_4+wrrds_3+wrrds_2+wrrds_1+(0.104719*ch2_float))/5;

/*frD=(((1-etz2_5)*((Lm*isD_1)-((Lr/Rr)*P*wrrds_1*frQ_1)))+(etz2_5*frD_1));
frQ=(((1-etz2_5)*((Lm*isQ_1)+((Lr/Rr)*P*wrrds_1*frD_1)))+(etz2_5*frQ_1));*/
/*frD=(((1-etz1_6)*((Lm*isD_1)-((Lr/Rr)*P*wrrds_1*frQ_1)))+(etz1_6*frD_1));
frQ=(((1-etz1_6)*((Lm*isQ_1)+((Lr/Rr)*P*wrrds_1*frD_1)))+(etz1_6*frQ_1));*/

frD=(0.80223847e-3*isD_1)-(0.332895663e-3*wrrds_1*frQ_1)+(etz1_6*frD_1);

frQ=(0.80223847e-3*isQ_1)+(0.332895663e-3*wrrds_1*frD_1)+(etz1_6*frQ_1);

/* fsD=(isD*(Lx/Lm))+(frD*(Lm/Lr));
fsQ=(isQ*(Lx/Lm))+(frQ*(Lm/Lr));*/
fsD=(isD*0.0298975)+(frD*0.9544077);
fsQ=(isQ*0.0298975)+(frQ*0.9544077);

/* may be it could be just used the square value */


sqr=(fsD*fsD)+(fsQ*fsQ);
mfs=sqrt(sqr);

/* using the table */


aux=fsQ/fsD;
if (aux < 0)
{aux=aux*(-1);
}

if( aux < 1 )


{index=(int)(aux*100);
angbis=table[index];
angbisfloat=(float)angbis; }
else if ( aux >= 100)
{angbis=table[199];
angbisfloat=(float)angbis; }
else

A.11
Appendixes.

{index=(int)(aux+99);
angbis=table[index];
angbisfloat=(float)angbis; }
if ( fsD > 0)
{ if( fsQ < 0)
{angbisfloat=(float)((-1)*angbis);}
}
else
{
if( fsQ > 0)
{angbisfloat=PI+((-1)*angbisfloat);}
else
{angbisfloat=(angbisfloat-PI);}
}
if (-PI < angbisfloat ) sectbis=4;
if ((-5*PI/6) < angbisfloat ) sectbis=5;
if ((-PI/2) < angbisfloat) sectbis=6;
if (-PI/6 < angbisfloat) sectbis=1;
if (PI/6 < angbisfloat) sectbis=2;
if (PI/2 < angbisfloat) sectbis=3;
if ((5*PI/6) < angbisfloat) sectbis= 4;

/* te=P*c*((fsD*isQ)-(fsQ*isD));*/
te=1.632992*((fsD*isQ)-(fsQ*isD));
}
/************************************************************************/
/* End function: flux_torque_est_zoh */
/************************************************************************/
/************************************************************************/
/* Function: dtc */
/************************************************************************/

void dtc (void)


{
/* new reference values are read in savw_data_DPRAM
before setting the FLAG=1 */

if ( mfs > mfs_plim)


mfs_e = 0;
else if ( mfs < mfs_nlim)
mfs_e = 1;

if ( te > (te_plim))
{te_e = 0;
}
/* te_e = 0; */
else if ( te < te_nlim)
{
te_e = 2;

}
else
{
te_e = 1;

A.12
Appendixes.

switch(sectbis)
{
case 1:
e_fi_ti=0xa5;
e_fi_td=0x99;
e_fd_ti=0xa6;
e_fd_td=0x9a;
e_fi_ti_b=2;
e_fi_td_b=6;
e_fd_ti_b=3;
e_fd_td_b=5;
break;
case 2:
e_fi_ti=0xa6;
e_fi_td=0xa9;
e_fd_ti=0x96;
e_fd_td=0x99;
e_fi_ti_b=3;
e_fi_td_b=1;
e_fd_ti_b=4;
e_fd_td_b=6;
break;
case 3:
e_fi_ti=0x96;
e_fi_td=0xa5;
e_fd_ti=0x9a;
e_fd_td=0xa9;
e_fi_ti_b=4;
e_fi_td_b=2;
e_fd_ti_b=5;
e_fd_td_b=1;
break;
case 4:
e_fi_ti=0x9a;
e_fi_td=0xa6;
e_fd_ti=0x99;
e_fd_td=0xa5;
e_fi_ti_b=5;
e_fi_td_b=3;
e_fd_ti_b=6;
e_fd_td_b=2;
break;
case 5:
e_fi_ti=0x99;
e_fi_td=0x96;
e_fd_ti=0xa9;
e_fd_td=0xa6;
e_fi_ti_b=6;
e_fi_td_b=4;
e_fd_ti_b=1;
e_fd_td_b=3;
break;
case 6:
e_fi_ti=0xa9;
e_fi_td=0x9a;

A.13
Appendixes.

e_fd_ti=0xa5;
e_fd_td=0x96;
e_fi_ti_b=1;
e_fi_td_b=5;
e_fd_ti_b=2;
e_fd_td_b=4;
break;
}
switch(te_e)
{
case 0:
if ( mfs_e == 0 )
{ e1 = e_fd_td;
e1_b = e_fd_td_b; }
else
{ e1 = e_fi_td;
e1_b = e_fi_td_b; }
break;
case 1:
if ( mfs_e == 0 )
{ e1 = e0;
e1_b = 0; }
else
{ e1 = e0;
e1_b = 0;}
break;
case 2:
if ( mfs_e == 0 )
{ e1 = e_fd_ti;
e1_b = e_fd_ti_b; }
else
{ e1 = e_fi_ti;
e1_b = e_fi_ti_b;}
break;
}

}
/************************************************************************/
/* End function: dtc */
/************************************************************************/
/************************************************************************/
/* Function: send_active_state */
/************************************************************************/
void send_active_state (void)
{
asm(" PUSH AR1");
asm(" PUSH R1");

asm(" LDI @_e1,R1");


asm(" LSH 16,R1");
/* as long as save_active_state is not used */
/* asm(" LDI @pointerdio,AR1");*/
/* asm(" LDI *AR1,R1");*/
asm(" LDI @posicio_DIO,AR1");
asm(" STI R1,*AR1");

A.14
Appendixes.

asm(" POP R1");


asm(" POP AR1");
}
/************************************************************************/
/* End function: send_active_state */
/************************************************************************/

/************************************************************************/
/* Function : save_data_DPRAM */
/************************************************************************/
void save_data_DPRAM (void)
{ float te_aux;

te_aux=te+10;
sectbis_aux=sectbis*(-1);
e1_b=e1_b*(-1);

*pointerf0=isD;
*pointerf1=isQ;
*pointerf2=te_aux;
/* *pointerf3=te_aux;
*pointerf4=11.2;
*pointerf5=8.6;
*pointerf6=te_e;
/* *pointerf7=e1_b;
*pointerf8=te;
/* *pointerf9=te_e;

/*10*/
/* *pointerfa=wrrds_1;*/
/* *pointerfb=te;
*pointerfc=ang;
*pointerfd=sect;
*pointerfe=frD;
*pointerff=frQ;
*pointerf10=wrrds;
*pointerf11=isDdef;
*pointerf12=isQdef;
*pointerf13=ange2;*/
/*20*/

/* new reference values are read in save_data_DPRAM


before setting the FLAG=1 */
mfs_set=*pointer_mfs_set;
te_set=*pointer_te_set;
mfs_hst=*pointer_mfs_hst;
te_hst=*pointer_te_hst;
mfs_plim=mfs_set+mfs_hst;
mfs_nlim=mfs_set-mfs_hst;
te_plim=te_set+te_hst;
te_nlim=te_set-te_hst;

FLAG=1;
*pointer_FLAG = FLAG;
}

A.15
Appendixes.

/************************************************************************/
/* End function: save_data_DPRAM */
/************************************************************************/

/************************************************************************/
/* Funcio : save_data_DPRAM_2
/************************************************************************/

void save_data_DPRAM_2 (void)


{ float mfs_set_aux,mfs_aux,te_set_aux,te_aux,wrrds_aux;

mfs_set_aux=mfs_set*(-1);
mfs_aux=mfs*(-1);
te_set_aux=te_set;
te_aux=te;
wrrds_aux=wrrds/(-10);

*pointerf0=mfs_set_aux;
*pointerf1=mfs_aux;
*pointerf2=te_set_aux;
*pointerf3=te_aux;
*pointerf4=wrrds_aux;
/* new reference values are read in save_data_DPRAM before setting the
FLAG=1 */
mfs_set=*pointer_mfs_set;
te_set=*pointer_te_set;
mfs_hst=*pointer_mfs_hst;
te_hst=*pointer_te_hst;
mfs_plim=mfs_set+mfs_hst;
mfs_nlim=mfs_set-mfs_hst;
te_plim=te_set+te_hst;
te_nlim=te_set-te_hst;

FLAG=1;
*pointer_FLAG = FLAG;

}
/************************************************************************/
/* End function: save_data_DPRAM_2 */
/************************************************************************/

/************************************************************************/
/* save_active_state */
/************************************************************************/
void save_active_state (void)
{
asm(" PUSH AR1");
asm(" PUSH R1");

asm(" LDI @pointerdio,AR1");


asm(" LDI @_e1,R1");
asm(" LSH 16,R1");
asm(" STI R1,*AR1");

asm(" POP R1");

A.16
Appendixes.

asm(" POP AR1");


}
/************************************************************************/
/* End: save_active_state */
/************************************************************************/

/************************************************************************/
/* bit1 */
/************************************************************************/
void bit1 (void)
{
asm(" PUSH AR1");
asm(" PUSH R1");

asm(" LDI 0000h,R1");


asm(" LSH 16,R1");
asm(" LDI @posicio_DIO2,AR1");
asm(" STI R1,*AR1");

asm(" POP R1");


asm(" POP AR1");
}
/************************************************************************/
/* End function: bit1 */
/************************************************************************/
/************************************************************************/
/* bit0 */
/************************************************************************/
void bit0 (void)
{
asm(" PUSH AR1");
asm(" PUSH R1");

asm(" LDI 00ffh,R1");


asm(" LSH 16,R1");
asm(" LDI @posicio_DIO2,AR1");
asm(" STI R1,*AR1");

asm(" POP R1");


asm(" POP AR1");

}
/************************************************************************/
/* End function: bit0 */
/************************************************************************/

/************************************************************************/

/************************************************************************/
/* Inizialization routines */
/************************************************************************/

/************************************************************************/
/* Function: set_amd16qs */
/* It inizializates the board AM/D16QS. */

A.17
Appendixes.

/************************************************************************/
void set_amd16qs(void)
{
asm(" LDI @AMELIA0,AR0");

asm(" LDI 0010h,R0");


asm(" LSH 16,R0");
asm(" STI R0,*+AR0(DCR)");

/* Reset AM/D16QS board */


asm(" LDI 0000h,R0");
asm(" STI R0,*+AR0(CMR)");

asm(" STI R0,*+AR0(CFR)");

/* User Control register config.*/


/* Value 28E3h: TCLK0 clk. factor 1/8 MCLK_0 and MCLK_1 as an output */
/*asm(" LDI 28E0h,R0");*/ /* /1 48 32 */
asm(" LDI 28E1h,R0"); /* /2 24 16 */
/*asm(" LDI 28E2h,R0");*/ /* /4 12 8 */
/*asm(" LDI 28E3h,R0");*/ /* /8 6 4 */

asm(" LSH 16,R0");


asm(" STI R0,*+AR0(CTR)");

/* Config. Serial Data Configuration Register */


/* 00c0h: Enable AMELIA2 */
asm(" LDI 00c0h,R0");
asm(" LSH 16,R0");
asm(" STI R0,*+AR0(SDC)");

/* Config. el Amelia Control Register */


/* Value 00F6h: out of reset, Master config., divide 384 */
/* enable chanals 2 i 3 and M_CLOCK_0 */

/*asm(" LDI 00F6h,R0"); */ /* 32 16 8 4 */


asm(" LDI 00E6h,R0"); /* 48 24 12 6 */

asm(" LSH 16,R0");


asm(" STI R0,*+AR0(CMR)");

/* Config. Configuration Register */


/* Value 8010h. It is cte */
asm(" LDI 8010h,R0");
asm(" LSH 16,R0");
asm(" STI R0,*+AR0(CFR)");

/* Config. Enhanced Configuration Register */


/* 00A0h: level int. It is reset either reading ISR */
/* or reading the channels */

asm(" LDI 00A0h,R0");

asm(" LSH 16,R0");


asm(" STI R0,*+AR0(ECFR)");

A.18
Appendixes.

/* Config. Enhanced Control Register */


/* Value 0003h. AMELIA2 int. when buffer FIFO is 100% full*/

/*asm(" LDI 0000h,R0");*/ /* 25% */


/*asm(" LDI 0001h,R0");*/
/*asm(" LDI 0002h,R0");*/
asm(" LDI 0003h,R0"); /* 100% */
asm(" LSH 16,R0");
asm(" STI R0,*+AR0(ECTR)");

/* Config. Interrupt Mask Register */


/* Value 2000h int. when buffer if full at the specified % */
asm(" LDI 2000h,R0");
asm(" LSH 16,R0");
asm(" STI R0,*+AR0(IMR)");

/* Wait loop calibration system */


/*asm(" LDI 0800h,R0");
asm(" LSH 13,R0");
asm("Calib_wait: SUBI 01h,R0");
asm(" BNZ Calib_wait");*/
asm(" LDI 0300h,R0");
asm(" LSH 15,R0");
asm("Calib_wait: SUBI 01h,R0");
asm(" BNZ Calib_wait");

/* Clean the FIFO (4 read for channel) */


asm(" LDI *+AR0(DR0),R0");
asm(" LDI *+AR0(DR1),R0");
asm(" LDI *+AR0(DR2),R0");
asm(" LDI *+AR0(DR3),R0");

asm(" LDI *+AR0(DR0),R0");


asm(" LDI *+AR0(DR1),R0");
asm(" LDI *+AR0(DR2),R0");
asm(" LDI *+AR0(DR3),R0");

asm(" LDI *+AR0(DR0),R0");


asm(" LDI *+AR0(DR1),R0");
asm(" LDI *+AR0(DR2),R0");
asm(" LDI *+AR0(DR3),R0");

asm(" LDI *+AR0(DR0),R0");


asm(" LDI *+AR0(DR1),R0");
asm(" LDI *+AR0(DR2),R0");
asm(" LDI *+AR0(DR3),R0");

/* Clean any int. (reading ISR) */


asm(" LDI *+AR0(ISR),R0");
}
/************************************************************************/
/* End function : set_amd16qs */
/************************************************************************/

A.19
Appendixes.

/************************************************************************/
/* Function: set_amd16sa */
/* It inizializates the board AM/D16QS. */
/************************************************************************/
void set_amd16sa(void)
{
asm(" LDI @DCR1,AR0");
asm(" LDI @DCR1_DEF,R0");
asm(" STI R0,*AR0");

asm(" LDI @UCR,AR0");


asm(" LDI @UCR_DEF,R0");
asm(" STI R0,*AR0");

asm(" LDI @ACR,AR0");


asm(" LDI @ACR_DEF,R0");
asm(" STI R0,*AR0");

asm(" LDI @TIMER1,AR0");


asm(" LDI @TIMER1_DEF,R0");
asm(" STI R0,*AR0");

asm(" LDI @CONFIG,AR0");


asm(" LDI @CONFIG_DEF,R0");
asm(" STI R0,*AR0");

asm(" LDI @IMR1,AR0");


asm(" LDI @IMR1_DEF,R0");
asm(" STI R0,*AR0");

}
/************************************************************************/
/* End function : set_amd16sa */
/************************************************************************/

/************************************************************************/
/* Funcio : dio32 */
/* Ini. dio32 */
/************************************************************************/
void dio32(void)
{
/* Dio32 as a master without any trigger */

/* asm(" LDI 0241h,R1");*/


asm(" LDI 023Ch,R1");
asm(" LSH 16,R1");
asm(" LDI @CONTROL,AR1");
asm(" STI R1,*AR1");

/* 32 bits as output */

asm(" LDI 1111h,R1");


asm(" LSH 16,R1");
asm(" LDI @PORTREG,AR1");
asm(" STI R1,*AR1");

A.20
Appendixes.

/* disconnect the bridge */


asm(" LDI 00ffh,R1");
asm(" LSH 16,R1");
asm(" LDI @posicio_DIO,AR1");
asm(" STI R1,*AR1");

asm(" LDI 0000h,R1");


asm(" LSH 16,R1");
asm(" LDI @posicio_DIO2,AR1");
asm(" STI R1,*AR1");

}
/************************************************************************/
/* End function : dio32 */
/************************************************************************/

/************************************************************************/
/* Funcio : atn_table */
/* Creates a table with ATN values */
/************************************************************************/
void atn_table(void)
{
double s=0,r=0;
int k=0;

for(k=0;k<=100;k++)
{
r=atan(s);
table[k]=r;
s=s+0.01;
}
for(k=100;k<=200;k++)
{
s=k-99;
r=atan(s);
table[k]=r;
}
}

/************************************************************************/
/* End function : atn_table */
/************************************************************************/

A.21
Appendixes.

A.1.2 - PCTH1_5c.c

/**********************************************************************/
/* PCTH1_5C.C Classical DTC */
/**********************************************************************/

/* Needed C files */
#include <dos.h>
#include <math.h>
#include <conio.h>

/* Needed C files for the DSP */


#include "c:\mon32\bc45\tic32.h"
#include<stdio.h>
#include<stdlib.h>
#include<time.h>

/* Memory DPRAM positions for the set points + exchange values */


#define FLAG 0x0c00009 // FLAG
#define HST_MFS 0xc0000bl // Flux set point_hst margin
#define HST_TE 0xc0000cl // Torque set point_hst margin
#define MFS 0xc0000dl // Flux set point
#define TE 0xc0000el // Torque set point
#define STOP 0xc00012l // SVM stop bit

#define f0 0xc00048l
#define f1 0xc00049l
#define f2 0xc0004al
#define f3 0xc0004bl
#define f4 0xc0004cl
#define f5 0xc0004dl
#define f6 0xc0004el
#define f7 0xc0004fl
#define f8 0xc00050l
#define f9 0xc00051l
/*10*/
#define fa 0xc00052l
#define fb 0xc00053l
#define fc 0xc00054l
#define fd 0xc00055l
#define fe 0xc00056l
#define ff 0xc00057l
#define f10 0xc00058l
#define f11 0xc00059l
#define f12 0xc0005al
#define f13 0xc0005bl
/*20*/
#define f14 0xc0005cl
#define f15 0xc0005dl

#define PI 3.141592654

/* DSP file */
#define FILENAME "TH1_5C.OUT"

A.22
Appendixes.

/* Global variables */

char x=0;
int s=0,j=0,k=0,i=0;
long int t=0 ;

/* Global adquisition variables */


float v0,v1,v2,v3,v4,v5,v6,v7,v8,v9,va,vb;
float vc,vd,ve,vf,v10,v11,v12,v13,v14,v15;
unsigned long stop=0,flag=0; // Stop + flag bit variable

/* set points */

float mfs_set=0,te_set=0,te_hst=0,mfs_hst=0;

double mfs_sug=0,te_set_d=0;
/* pointer file */

FILE *f_grf;
/* data matrix */
/*float dt [10][901];*/
float dt [9][901];
/* Functions definition */
void IniciDSP(void);
void EngegaDSP(void);
void AturaDSP(void);
void ReadDPRAM(void);
void Savedata(void);
void Setpoints(void);
void Setpoints1(void);
void Data2file(void);
void main (void)
{
clrscr();
printf("\nPress '1' to start");
x = getch();
if (x=='1')
{
IniciDSP();
delay(500);
Setpoints();
delay (200);
EngegaDSP();
delay (4000);
/* Setpoints1();
delay (5000);
Setpoints1();
delay (5000);*/
Setpoints1();
delay (5000);
printf("\nSaving data");
for(t=0; t<1000000 ; t++)
{

A.23
Appendixes.

for (s=0; s<5 ; s++)


{
}
s=0;
Get_DPRAM_Word_32(FLAG,&flag);
if (flag == 1 )
{
if ( j <= 900 )
{
ReadDPRAM();
Savedata();
j++;
}
flag=0;
Put_DPRAM_Word_32(FLAG,flag);
}
}
}
AturaDSP();
Data2file();
}

/***************************************************************** */
/* DSP inizialization */
/******************************************************************/
void IniciDSP(void)
{
/* Seleccio data type for the DSP */
Set_Processor_Data_Type_Size_32();

/* DSP Inicialitzation. Board adress (0x290), DPRMA adress (0xD00)*/


/* bus ISA size */
Select_Board(0x290, 0xd00, 8);

/* Enable DPRAM */
Enable_DPRAM();

/* DSP reset */
Global_Reset();

/* Load the file to be executed */


Load_Object_File(FILENAME);

}
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/* End of DSP inizialization */
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/

/******************************************************************/
/* Start up DSP */
/******************************************************************/
void EngegaDSP(void)
{ stop=0;
Put_DPRAM_Word_32(STOP, stop);

A.24
Appendixes.

/* Run file */
Run_From(Get_Entry_PC());
delay(2000);
}
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/* End start up DSP */
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/

/******************************************************************/
/* Setpoints */
/******************************************************************/
void Setpoints(void)
{

printf("\n\nTorque setpoint N/m: ");


scanf("%f", &te_set);
Put_DPRAM_Float_32(TE,te_set);
printf("Torque set point hst margin: ");
scanf("%f", &te_hst);
Put_DPRAM_Float_32(HST_TE,te_hst);

te_set_d=te_set;
mfs_sug=0.3665*sqrt(te_set_d);
printf("\nThe suggested optimized flux square value is %lf",
mfs_sug);
printf("\nFlux set point: ");
scanf("%f", &mfs_set);
Put_DPRAM_Float_32(MFS,mfs_set);
printf("Flux set point hst margin: ");
scanf("%f", &mfs_hst);
Put_DPRAM_Float_32(HST_MFS,mfs_hst);
/* old version */
/* printf("\nFlux set point: ");
scanf("%f", &mfs_set);
Put_DPRAM_Float_32(MFS,mfs_set);
printf("Flux set point hst margin: ");
scanf("%f", &mfs_hst);
Put_DPRAM_Float_32(HST_MFS,mfs_hst);
printf("Torque setpoint N/m: ");
scanf("%f", &te_set);
Put_DPRAM_Float_32(TE,te_set);
printf("Torque set point hst margin: ");
scanf("%f", &te_hst);
Put_DPRAM_Float_32(HST_TE,te_hst);*/

}
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/* End setpoints */
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/

/******************************************************************/
/* Setpoints1 */
/******************************************************************/
void Setpoints1(void)
{

A.25
Appendixes.

printf("\nTorque setpoint N/m: ");


scanf("%f", &te_set);
Put_DPRAM_Float_32(TE,te_set);
te_set_d=te_set;
/* because squared value */
mfs_sug=0.3665*sqrt(te_set_d);
printf("\nThe suggested optimized flux value is %lf", mfs_sug);
printf("\nFlux set point: ");
scanf("%f", &mfs_set);
Put_DPRAM_Float_32(MFS,mfs_set);

/*old version */
/* printf("\nFlux set point: ");
scanf("%f", &mfs_set);
Put_DPRAM_Float_32(MFS,mfs_set);
printf("Torque setpoint N/m: ");
scanf("%f", &te_set);
Put_DPRAM_Float_32(TE,te_set);*/

}
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/* End setpoints1 */
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/

/******************************************************************/
/* Read DPRAM */
/******************************************************************/

void ReadDPRAM(void)
{
Get_DPRAM_Float_32(f0,&v0);
Get_DPRAM_Float_32(f1,&v1);
Get_DPRAM_Float_32(f2,&v2);
/*Get_DPRAM_Float_32(f3,&v3);
Get_DPRAM_Float_32(f4,&v4);
Get_DPRAM_Float_32(f5,&v5);
Get_DPRAM_Float_32(f6,&v6);
/*Get_DPRAM_Float_32(f7,&v7);
Get_DPRAM_Float_32(f8,&v8);
/*Get_DPRAM_Float_32(f9,&v9);
/*10*/
/*Get_DPRAM_Float_32(fa,&va);
Get_DPRAM_Float_32(fb,&vb);
Get_DPRAM_Float_32(fc,&vc);
Get_DPRAM_Float_32(fd,&vd);
Get_DPRAM_Float_32(fe,&ve);
Get_DPRAM_Float_32(ff,&vf);
Get_DPRAM_Float_32(f10,&v10);
Get_DPRAM_Float_32(f11,&v11);
Get_DPRAM_Float_32(f12,&v12);
Get_DPRAM_Float_32(f13,&v13); */
/*20*/
/*Get_DPRAM_Float_32(f14,&v14);
Get_DPRAM_Float_32(f15,&v15);*/

A.26
Appendixes.

}
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/* End read DPRAM */
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/

/******************************************************************/
/* Savedata */
/******************************************************************/

void Savedata(void)
{
dt[0][j]=v0;
dt[1][j]=v1;
dt[2][j]=v2;
/*dt[3][j]=v3;
dt[4][j]=v4;
dt[5][j]=v5;
dt[6][j]=v6;
/*dt[7][j]=v7;
dt[8][j]=v8;
/*dt[9][j]=v9;
/*10*/
/*dt[10][j]=va;
dt[11][j]=vb;
dt[12][j]=vc;
dt[13][j]=vd;
dt[14][j]=ve;
dt[15][j]=vf;
dt[16][j]=v10;
dt[17][j]=v11;
dt[18][j]=v12;
dt[19][j]=v13;*/
/*20*/
/*dt[20][j]=v14;
dt[21][j]=v15;*/
}
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/* End save data */
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/

/******************************************************************/
/* Stop DSP */
/******************************************************************/
void AturaDSP(void)
{ stop=1;
Put_DPRAM_Word_32(STOP, stop);
}
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/* End stop DSP */
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/******************************************************************/
/* Data2file */
/******************************************************************/
void Data2file(void)
{

A.27
Appendixes.

if ((f_grf = fopen("\\DTC2.GRF", "w")) == 0)


{
printf("Unable to open file");
return;
}
else
{
for(k=0;k<j;k++)
{
/* fprintf(f_grf, "%e %e %e %e %e %e %e
\n",dt[0][k],dt[1][k],dt[2][k],dt[3][k],dt[4][k],dt[5][k],dt[6][k]);*/
fprintf(f_grf, "%e %e %e \n",dt[0][k],dt[1][k],dt[2][k]);
}
fclose(f_grf);
}
}
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/* End Data2file */
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/

A.28
Appendixes.

A.1.3 - TH1_9.c

/* File : TH1_9.C */
/* Description: FLDTC */
/*_________________________*/
/* arc tangent function */

#include <c:\proves\math.h>

/* DPRAM Positions */
#define posicio_memoria_FLAG 0x0c00009 /*Flag*/
#define posicio_memoria_COUNTER 0x0c0000a
#define posicio_memoria_mfs_hst 0x0c0000b /*Flux set point_hst margin*/
#define posicio_memoria_te_hst 0x0c0000c /*Electr. torque set point_hst
margin*/
#define posicio_memoria_mfs_set 0x0c0000d /*Flux set point*/
#define posicio_memoria_te_set 0x0c0000e /*Electr. torque set point*/
#define posicio_memoria_STOP 0x0c00012 /*Stop bit*/
/* Start obtaining the DC */
#define posicio_memoria_START 0x0c00013 /*Start bit*/
/* Errors in obtaining the DC */
#define posicio_memoria_ERROR 0x0c00014 /*Number of errors*/
/* FLC1 references values */
#define posicio_memoria_FLUX_ANGLE_I 0x0c00015 /*Flux angle*/
#define posicio_memoria_TE_ERR_I 0x0c00016 /*Torque error i+1*/
#define posicio_memoria_WM 0x0c00017 /*Motor speed */
#define posicio_memoria_FI 0x0c00018 /*FI=0 flux decrease */
/*FI=1 increase */
/* FLC2 refernces values */
#define posicio_memoria_TE_ERR_I_1 0x0c00019 /*Torque error i*/
#define posicio_memoria_COUNT1 0x0c0001a /*Increment Torque error
i+1*/

#define posicio_memoria_DC_AUX 0x0c0001d /*Last duty cycle*/


#define posicio_memoria_INC_DC 0x0c0001e /*FLC2 set point*/
#define posicio_memoria_EQ 0x0c0001f /*Equal signal*/

/* duty cycle */
#define posicio_memoria_DCFLC1 0x0c0001b /*Duty cycle from FLC1*/
#define posicio_memoria_DCFLC2 0x0c0001c /*Duty cycle from FLC2*/

#define posicio_memoria_f0 0x0c00048


#define posicio_memoria_f1 0x0c00049
#define posicio_memoria_f2 0x0c0004a
#define posicio_memoria_f3 0x0c0004b
#define posicio_memoria_f4 0x0c0004c
#define posicio_memoria_f5 0x0c0004d
#define posicio_memoria_f6 0x0c0004e
#define posicio_memoria_f7 0x0c0004f
#define posicio_memoria_f8 0x0c00050
#define posicio_memoria_f9 0x0c00051

A.29
Appendixes.

/*10*/
#define posicio_memoria_fa 0x0c00052
#define posicio_memoria_fb 0x0c00053
#define posicio_memoria_fc 0x0c00054
#define posicio_memoria_fd 0x0c00055
#define posicio_memoria_fe 0x0c00056
#define posicio_memoria_ff 0x0c00057
#define posicio_memoria_f10 0x0c00058
#define posicio_memoria_f11 0x0c00059
#define posicio_memoria_f12 0x0c0005a
#define posicio_memoria_f13 0x0c0005b
/*20*/
#define posicio_memoria_f14 0x0c0005c
#define posicio_memoria_f15 0x0c0005d
#define posicio_memoria_f16 0x0c0005e
#define posicio_memoria_f17 0x0c0005f
#define posicio_memoria_f18 0x0c00060
#define posicio_memoria_f19 0x0c00061
#define posicio_memoria_f1a 0x0c00062
#define posicio_memoria_f1b 0x0c00063
#define posicio_memoria_f1c 0x0c00064
#define posicio_memoria_f1d 0x0c00065
/*30*/
#define posicio_memoria_f1e 0x0c00066
#define posicio_memoria_f1f 0x0c00067
#define posicio_memoria_f20 0x0c00068
#define posicio_memoria_f21 0x0c00069
#define posicio_memoria_f22 0x0c0006a
#define posicio_memoria_f23 0x0c0006b
#define posicio_memoria_f24 0x0c0006c
#define posicio_memoria_f25 0x0c0006d
#define posicio_memoria_f26 0x0c0006e
#define posicio_memoria_f27 0x0c0006f
/*40*/
#define posicio_memoria_f28 0x0c00070
#define posicio_memoria_f29 0x0c00071
#define posicio_memoria_f2a 0x0c00072
#define posicio_memoria_f2b 0x0c00073
#define posicio_memoria_f2c 0x0c00074
#define posicio_memoria_f2d 0x0c00075
#define posicio_memoria_f2e 0x0c00076
#define posicio_memoria_f2f 0x0c00077

#define PI 3.141592654

asm(" .data");

/* Direccio registre de control del timer 1 */

A.30
Appendixes.

asm("TIMECTRL .long 00808030h");

/* #define RSTCTRL 00000601 */


asm("RSTCTRL .set 00000601h");

/* Paraula de control que engega el timer 1 */


/* #define SETCTRL 000006c1 */
asm("SETCTRL .set 000006c1h");

/* Timer 1 register adresses */


asm("COUNTER .long 00808034h");
asm("PERIOD .long 00808038h");

/* Direccio registre de configuracio de la DIO32 */

asm("COUNTDPRAM .long 0c00016h");

/* Defineixo les adreces dels quatre canals anal•gics*/

/* #define posicio_DIO 0828000 */


asm("posicio_DIO .long 00828000h");
asm("posicio_DIO2 .long 00828002h");
asm("posicio_DIO3 .long 00828004h");
asm("posicio_DIO4 .long 00828006h");

/* #define PORTREG 00828007 */


asm("PORTREG .long 00828007h");
/* Direccio registre de control de la DIO32 */
/* #define CONTROL 00828005 */
asm("CONTROL .long 00828005h");

asm("dio1 .long 00ff0000h");


asm("c1 .long 450");
asm("pointerdio .long dio1");

asm("STR0A .word 00808064h");


asm("STR0D .word 004F0900h");
asm("STR1A .word 00808068h");
asm("STR1D .word 00070900h");
asm("IOSTRA .word 00808060h");
asm("IOSTRD .word 00000000h");

asm("AMELIA0 .word 0081A000h");

asm("ITTP .word 06000000h");

asm("Mascara .word 0000ffffh");

/* Map Registers AMELIA2 */

asm("DR3 .equ 01h");


asm("DR0 .equ 02h");
asm("DR2 .equ 03h");
asm("TMR0 .equ 04h");
asm("TMR1 .equ 05h");

A.31
Appendixes.

asm("DR1 .equ 06h");


asm("IMR .equ 07h");
asm("CTR .equ 08h");
asm("ECTR .equ 09h");
asm("SMR .equ 0ah");
asm("CMR .equ 0ah");
asm("ISR .equ 0bh");
asm("DCR .equ 0ch");
asm("SDC .equ 0dh");
asm("ECFR .equ 0eh");
asm("CFR .equ 0fh");

/* Map Register AMELIA2 */

asm("TIMER1 .word 81B005h");


asm("UCR .word 81B008h");
asm("ACR .word 81B00Ah");
asm("CONFIG .word 81B00Fh");
asm("IMR1 .word 81B00Bh");
asm("DCR1 .word 81B00Ch");
asm("CH0 .word 81B002h");
asm("CH1 .word 81B006h");

/* Constants */
asm("IMR1_DEF .word 000010000h");
asm("DCR1_DEF .word 0001e0000h");
asm("TIMER1_DEF .word 0fd9b0000h");
asm("UCR_DEF .word 0a4000000h");
asm("ACR_DEF .word 000f20000h");
asm("CONFIG_DEF .word 08dff0000h");

/* Program section called 'int0X' where the interruprion vector is placed*/


/* c_int0X is the name of the rotuine address */

asm(" .sect \".int01\"");


asm(" .word _c_int01");

asm(" .sect \".int02\"");


asm(" .word _c_int02");

asm(" .sect \".int05\"");


asm(" .word _c_int05");

asm(" .sect \".int10\"");


asm(" .word _c_int10");

/* End int label section */

asm(" .text");

/* pointers */
long * pointer_FLAG=(long *)posicio_memoria_FLAG;
long * pointer_COUNTER=(long *)posicio_memoria_COUNTER;
long * pointer_ERROR=(long *)posicio_memoria_ERROR;
float * pointer_mfs_set=(float *)posicio_memoria_mfs_set;
float * pointer_te_set=(float *)posicio_memoria_te_set;

A.32
Appendixes.

float * pointer_mfs_hst=(float *)posicio_memoria_mfs_hst;


float * pointer_te_hst=(float *)posicio_memoria_te_hst;
long * pointerSTOP=(long *)posicio_memoria_STOP;

long * pointerSTART=(long *)posicio_memoria_START;


float * pointer_flux_angle_i=(float *)posicio_memoria_FLUX_ANGLE_I;
float * pointer_te_err_i=(float *)posicio_memoria_TE_ERR_I;
float * pointer_wm=(float *)posicio_memoria_WM;
long * pointerFI=(long *)posicio_memoria_FI;

long * pointer_count1=(long *)posicio_memoria_COUNT1;


float * pointer_dc_aux=(float *)posicio_memoria_DC_AUX;
float * pointer_inc_dc=(float *)posicio_memoria_INC_DC;
long * pointerEQ=(long *)posicio_memoria_EQ;

long * pointerDCFLC1=(long *)posicio_memoria_DCFLC1;


long * pointerDCFLC2=(long *)posicio_memoria_DCFLC2;

float * pointerf0=(float *)posicio_memoria_f0;


float * pointerf1=(float *)posicio_memoria_f1;
float * pointerf2=(float *)posicio_memoria_f2;
float * pointerf3=(float *)posicio_memoria_f3;
float * pointerf4=(float *)posicio_memoria_f4;
float * pointerf5=(float *)posicio_memoria_f5;
float * pointerf6=(float *)posicio_memoria_f6;
float * pointerf7=(float *)posicio_memoria_f7;
float * pointerf8=(float *)posicio_memoria_f8;
float * pointerf9=(float *)posicio_memoria_f9;
/*10*/
float * pointerfa=(float *)posicio_memoria_fa;
float * pointerfb=(float *)posicio_memoria_fb;
float * pointerfc=(float *)posicio_memoria_fc;
float * pointerfd=(float *)posicio_memoria_fd;
float * pointerfe=(float *)posicio_memoria_fe;
float * pointerff=(float *)posicio_memoria_ff;
float * pointerf10=(float *)posicio_memoria_f10;
float * pointerf11=(float *)posicio_memoria_f11;
float * pointerf12=(float *)posicio_memoria_f12;
float * pointerf13=(float *)posicio_memoria_f13;
/*20*/
float * pointerf14=(float *)posicio_memoria_f14;
float * pointerf15=(float *)posicio_memoria_f15;
float * pointerf16=(float *)posicio_memoria_f16;
float * pointerf17=(float *)posicio_memoria_f17;
float * pointerf18=(float *)posicio_memoria_f18;
float * pointerf19=(float *)posicio_memoria_f19;
float * pointerf1a=(float *)posicio_memoria_f1a;
float * pointerf1b=(float *)posicio_memoria_f1b;
float * pointerf1c=(float *)posicio_memoria_f1c;
float * pointerf1d=(float *)posicio_memoria_f1d;
/*30*/
float * pointerf1e=(float *)posicio_memoria_f1e;
float * pointerf1f=(float *)posicio_memoria_f1f;
float * pointerf20=(float *)posicio_memoria_f20;
float * pointerf21=(float *)posicio_memoria_f21;
float * pointerf22=(float *)posicio_memoria_f22;

A.33
Appendixes.

float * pointerf23=(float *)posicio_memoria_f23;


float * pointerf24=(float *)posicio_memoria_f24;
float * pointerf25=(float *)posicio_memoria_f25;
float * pointerf26=(float *)posicio_memoria_f26;
float * pointerf27=(float *)posicio_memoria_f27;
/*40*/
float * pointerf28=(float *)posicio_memoria_f28;
float * pointerf29=(float *)posicio_memoria_f29;
float * pointerf2a=(float *)posicio_memoria_f2a;
float * pointerf2b=(float *)posicio_memoria_f2b;
float * pointerf2c=(float *)posicio_memoria_f2c;
float * pointerf2d=(float *)posicio_memoria_f2d;
float * pointerf2e=(float *)posicio_memoria_f2e;
float * pointerf2f=(float *)posicio_memoria_f2f;

int d=0,STOP=0,FLAG=0,s=0;

/* aux*/
int in1,in2,count1,index1,index2,index3;
float fin3,Tpc,Wpc;

/* DTC variables */
int e1=0x95,e2=0x95,e7=0x95,e0=0xbf;
int e1_b=0;
int e_fi_ti=0xaa,e_fd_ti=0xaa,e_fi_td=0xaa,e_fd_td=0xaa;
int e_fi_ti_b=0,e_fd_ti_b=0,e_fi_td_b=0,e_fd_td_b=0;

int te_e=0,mfs_e=0;
float te_plim=0,te_nlim=0,mfs_plim=0,mfs_nlim=0,te_hst=0,mfs_hst=0;
float mfs_set=0,te_set=0;

/* FLDTC variables */
int COUNTER_AUX=0,COUNTER=0,DC2=0,DC=0,ERROR=0,ERROR_FLAG=0,START=0;
int e1_b_1=0;
int EQ_aux=0,EQ=0;
float dc_aux=1,inc_dc=0;

/*FLC1 variables*/
int DCFLC1=0,FI=0;
float te_err_i=0,wm=0;

/* FLC2 variables */
int DCFLC2=0;
float te_err_i_1=0,inc_te_i=0;
float te_1=0;

/* adquisition variables*/
long int ch0=0,ch1=0,ch2=0;
long int *pch0=&ch0,*pch1=&ch1,*pch2=&ch2;
float ch0_float=0,ch1_float=1,ch2_float=0;

/* estimator zoh variables */


float isD=0,isQ=0,frD=0,frQ=0,fsD=0,fsQ=0,mfs=0,te=0,ang=0,sect=0;
float frD_1=0,frQ_1=0,isD_1=0,isQ_1=0;
float wrrds=0,wrrds_1=0,wrrds_2=0,wrrds_3=0,wrrds_4=0;
float sectbis_aux=0,angbisfloat=0;

A.34
Appendixes.

int sectbis=0;
float etz1_25=0.99803070219,etz1_6=0.9973751317,etz2_5=0.9960652825;
float Rr=5.05,Lm=0.30563,P=2,Lr=0.32023;
float Lx=0.0091376,c=0.816496,stz=0;

double angbis=0,table[402];

/* Functions */
void c_int01(void); /* Amelia int */
void c_int02(void); /* Amelia int */
void c_int05(void); /* Control */
void c_int10(void); /* Timer */

void set_amd16qs(void); /* ADC inizialization */


void set_amd16sa(void); /* ADC inizialization */
void dio32(void); /* DIO inizialization */
void set_c32_timer1(void); /* TIMER 1 inizialization */
void atn_table (void); /* ATN table */
void get_ADC(void); /* read 2 currents + wm */
void flux_torque_est_zoh(void); /* Flux and torque estimation zoh */
void dtc(void); /* dtc */
void save_data_DPRAM(void); /* saving data in DPRAM */
void save_data_DPRAM_2(void); /* saving data in DPRAM_2 */
void send_active_state(void); /* send the active state */
void save_active_state(void); /* save the active state */
void program_timer1(void); /* Timer 1 programing*/
void get_DC(void); /* Get Duty cycle */
void bit1(void);
void bit0(void);

/************************************************************************/
/* Funcio : main */
/************************************************************************/
void main(void)
{

asm(" LDP STR0A,DP");


asm(" LDP @STR0A,AR0");
asm(" LDP @STR0D,R0");
asm(" STI R0,*AR0");

asm(" LDP STR1A,AR0");


asm(" LDP STR1D,R0");
asm(" STI R0,*AR0");

asm(" LDP IOSTRA,AR0");


asm(" LDP IOSTRD,R0");
asm(" STI R0,*AR0");
/* null state to VSI */
dio32();

do {
STOP=*pointerSTOP;
}
while (STOP==1);

A.35
Appendixes.

if (STOP == 0)
{ atn_table();
/* getting the reference values */
mfs_set=*pointer_mfs_set;
te_set=*pointer_te_set;
Tpc=te_set*100/9.8;
mfs_hst=*pointer_mfs_hst;
te_hst=*pointer_te_hst;
mfs_plim=mfs_set+mfs_hst;
mfs_nlim=mfs_set-mfs_hst;
te_plim=te_set+te_hst;
te_nlim=te_set-te_hst;
/* ini ADC */
set_amd16qs();
set_amd16sa();

asm(" LDI @ITTP,IF");


/* Enalbing interruptions INT0 +INT1 + INT5 of PC/C32 board */
asm(" LDI 0013h,IE");
/* Globals int enable */
asm(" OR 2000h,ST");
/* Start Cache */
asm(" OR 0800h,ST");

}
do {
STOP=*pointerSTOP;
for(s=0;s<20;s++)
{
}
s=0;
}
while (STOP==0);
/* dis int */
asm(" AND 0000h,IE");
asm(" AND 0000h,ST");
/* disconnect VSI */
asm(" LDI 00ffh,R1");
asm(" LSH 16,R1");
asm(" LDI @posicio_DIO,AR1");
asm(" STI R1,*AR1");
*pointer_COUNTER=COUNTER;
*pointer_ERROR=ERROR;

}
/************************************************************************/
/* End function : main */
/************************************************************************/

/************************************************************************/
/* Funcio : c_int01 */
/* Amelia2 A int*/
/************************************************************************/
void c_int01(void)
{
asm(" PUSH AR0");

A.36
Appendixes.

asm(" PUSH AR2");


asm(" PUSH R0");

/* disable int*/
asm(" ANDN 2000h,ST");

asm(" LDI @AMELIA0,AR0");


asm(" LDI *+AR0(ISR),R0");

asm(" LDI *+AR0(DR0),R0");


asm(" LDI *+AR0(DR1),R0");
asm(" LDI *+AR0(DR2),R0");
asm(" LDI *+AR0(DR3),R0");

asm(" LDI *+AR0(DR0),R0");


asm(" LDI *+AR0(DR1),R0");
asm(" LDI *+AR0(DR2),R0");
asm(" LDI *+AR0(DR3),R0");

asm(" LDI *+AR0(DR0),R0");


asm(" LDI *+AR0(DR1),R0");
asm(" LDI *+AR0(DR2),R0");
asm(" LDI *+AR0(DR3),R0");

asm(" LDI *+AR0(DR0),R0");


asm(" LDI *+AR0(DR1),R0");
asm(" LDI *+AR0(DR2),R0");
asm(" ASH -16,R0");
asm(" LDI @_pch2,AR2");
asm(" STI R0,*AR2");
asm(" LDI *+AR0(DR3),R0");

/* int 05 is set*/
asm(" OR 010h,IF");

asm(" POP R0");


asm(" POP AR2");
asm(" POP AR0");
/* erase this interrupt flag */
asm(" ANDN 1h,IF");

}
/************************************************************************/
/* End Function : c_int01 */
/************************************************************************/

/************************************************************************/
/* Funcio : c_int02 */
/* AMELIA2 B int */
/************************************************************************/
void c_int02(void)
{
asm(" PUSH AR0");
asm(" PUSH AR1");
asm(" PUSH AR2");
asm(" PUSH R0");

A.37
Appendixes.

asm(" PUSH R1");


/* disable int*/
asm(" ANDN 2000h,ST");

asm(" LDI @IMR1,AR0");


asm(" LDI *AR0,R0");

asm(" LDI @CH0,AR0");


asm(" LDI @CH1,AR1");
asm(" LDI *AR0,R0");
asm(" LDI *AR1,R1");
asm(" ASH -16,R0");
asm(" LDI @_pch0,AR2");
asm(" STI R0,*AR2");
asm(" ASH -16,R1");
asm(" LDI @_pch1,AR2");
asm(" STI R1,*AR2");

asm(" POP R1");


asm(" POP R0");
asm(" POP AR2");
asm(" POP AR1");
asm(" POP AR0");

/* erase this interrupt flag */


asm(" ANDN 2h,IF");

}
/************************************************************************/
/* End function : c_int02 */
/************************************************************************/

/************************************************************************/
/* Funcio : c_int05 (166 us) */
/************************************************************************/
void c_int05 (void)
{ /* *pointer_FLAG = 0;*/
bit1();
get_ADC();
flux_torque_est_zoh();
dtc();
send_active_state();
bit0();
flc_set_points();
*pointerSTART=1;
/* save_data_DPRAM();*/
save_data_DPRAM_2();
for(d=0;d<150;d++)
{
}
d=0;
get_DC();
program_timer1();
/* DC=0;
asm(" LDI @PERIOD,AR0");

A.38
Appendixes.

asm(" LDI @_DC,R0");


asm(" STI R0,*AR0");
asm(" LDI @TIMECTRL,AR0");
asm(" LDI SETCTRL,R0");
asm(" STI R0,*AR0");
asm(" OR 200h,IE");*/

/* bit1(); */
/* save_data_DPRAM();*/

}
/************************************************************************/
/* End c_int05 (166us) */
/************************************************************************/

/************************************************************************/
/* Funcio : get_ADC (estimator)
/* Retorna : res */
/************************************************************************/
void get_ADC (void)
{
/* disable int*/
asm(" ANDN 2000h,ST");

/* get isA,isB,wm */

/* 65535 / 6volts ; 1volt / 7.0922 amp */


/* ch0_float=-(1.0*ch0*9.155273438e-5*7.1*1.03*6.11/7)+3.5e-3;
ch1_float=-(1.0*ch1*9.155273438e-5*7.1*1.015*6.11/7)-3.0e-2;*/

/* 65535 / 6volts ; 1volt / 10 amp */


/* LEM probe */
ch0_float=-(1.0*ch0*9.155273438e-5*10*4.85/5.15);
/* Tektronic Probe */
ch1_float=-(1.0*ch1*9.155273438e-5*10);

/* 65535 / 4volts ; 6e-2volts / 1rpm */


ch2_float=-(1.0*(ch2-170.5)*6.103515625e-5/(1.10965*6e-4));

/* enalbe global int*/


asm(" OR 2000h,ST");
}
/************************************************************************/
/* End function : get_ADC (estimator) */
/************************************************************************/
/************************************************************************/
/* flux_torque_est_zoh */
/************************************************************************/
void flux_torque_est_zoh(void)
{ /* using the square value */
double sqr=0;
float aux=0;
int index=0;

frD_1=frD;

A.39
Appendixes.

frQ_1=frQ;
wrrds_4=wrrds_3;
wrrds_3=wrrds_2;
wrrds_2=wrrds_1;
wrrds_1=wrrds;
isD_1=isD;
isQ_1=isQ;

te_1=te;

isD=1.2247*ch0_float;
/* isQ=0.95*(1.4142135*ch1_float)+(0.7071067*ch0_float);*/
isQ=(1.3435028*ch1_float)+(0.7071067*ch0_float);
/* wrrds=(wrrds_4+wrrds_3+wrrds_2+wrrds_1+(2*PI/60*ch2_float))/5;*/
wrrds=(wrrds_4+wrrds_3+wrrds_2+wrrds_1+(0.104719*ch2_float))/5;

/*frD=(((1-etz2_5)*((Lm*isD_1)-((Lr/Rr)*P*wrrds_1*frQ_1)))+(etz2_5*frD_1));
frQ=(((1-etz2_5)*((Lm*isQ_1)+((Lr/Rr)*P*wrrds_1*frD_1)))+(etz2_5*frQ_1));*/
/*frD=(1.20256771e-3*isD_1)-(0.499015431e-3*wrrds_1*frQ_1)+(etz2_5*frD_1);
frQ=(1.20256771e-3*isQ_1)+(0.499015431e-3*wrrds_1*frD_1)+(etz2_5*frQ_1);*/
/*frD=(((1-etz1_6)*((Lm*isD_1)-((Lr/Rr)*P*wrrds_1*frQ_1)))+(etz1_6*frD_1));
frQ=(((1-etz1_6)*((Lm*isQ_1)+((Lr/Rr)*P*wrrds_1*frD_1)))+(etz1_6*frQ_1));*/

frD=(0.80223847e-3*isD_1)-(0.332895663e-3*wrrds_1*frQ_1)+(etz1_6*frD_1);
frQ=(0.80223847e-3*isQ_1)+(0.332895663e-3*wrrds_1*frD_1)+(etz1_6*frQ_1);

/*

frD=(((1-etz1_25)*((Lm*isD_1)-((Lr/Rr)*P*wrrds_1*frQ_1)))+(etz1_25*frD_1));

frQ=(((1-etz1_25)*((Lm*isQ_1)+((Lr/Rr)*P*wrrds_1*frD_1)))+(etz1_25*frQ_1));
*/

/* fsD=(isD*(Lx/Lm))+(frD*(Lm/Lr));
fsQ=(isQ*(Lx/Lm))+(frQ*(Lm/Lr));*/
fsD=(isD*0.0298975)+(frD*0.9544077);
fsQ=(isQ*0.0298975)+(frQ*0.9544077);

/* may be it could be just used the square value */


sqr=(fsD*fsD)+(fsQ*fsQ);
mfs=sqrt(sqr);
/* using the square value */
/* mfs=(fsD*fsD)+(fsQ*fsQ);*/

/* using the table */


aux=fsQ/fsD;
if (aux < 0)
{aux=aux*(-1);
}

if( aux < 1 )


{index=(int)(aux*100);
angbis=table[index];
angbisfloat=(float)angbis; }

A.40
Appendixes.

else if ( aux >= 100)


{angbis=table[199];
angbisfloat=(float)angbis; }
else
{index=(int)(aux+99);
angbis=table[index];
angbisfloat=(float)angbis; }

if ( fsD > 0)
{ if( fsQ < 0)
{angbisfloat=(float)((-1)*angbis);}
}
else
{
if( fsQ > 0)
{angbisfloat=PI+((-1)*angbisfloat);}
else
{angbisfloat=(angbisfloat-PI);}
}

if (-PI < angbisfloat ) sectbis=4;


if ((-5*PI/6) < angbisfloat ) sectbis=5;
if ((-PI/2) < angbisfloat) sectbis=6;
if (-PI/6 < angbisfloat) sectbis=1;
if (PI/6 < angbisfloat) sectbis=2;
if (PI/2 < angbisfloat) sectbis=3;
if ((5*PI/6) < angbisfloat) sectbis= 4;

/* te=P*c*((fsD*isQ)-(fsQ*isD));*/
te=1.632992*((fsD*isQ)-(fsQ*isD));
}
/************************************************************************/
/* End function: flux_torque_est_zoh */
/************************************************************************/
/************************************************************************/
/* dtc */
/************************************************************************/

void dtc (void)


{ /* needed for FLDTC */
e1_b_1=e1_b;

if ( mfs > mfs_plim)


mfs_e = 0;
else if ( mfs < mfs_nlim)
mfs_e = 1;

if ( te > (te_plim))
te_e = 0;
else
te_e = 2;

switch(sectbis)
{
case 1:

A.41
Appendixes.

e_fi_ti=0xa5;
e_fi_td=0x99;
e_fd_ti=0xa6;
e_fd_td=0x9a;
e_fi_ti_b=2;
e_fi_td_b=6;
e_fd_ti_b=3;
e_fd_td_b=5;
break;
case 2:
e_fi_ti=0xa6;
e_fi_td=0xa9;
e_fd_ti=0x96;
e_fd_td=0x99;
e_fi_ti_b=3;
e_fi_td_b=1;
e_fd_ti_b=4;
e_fd_td_b=6;
break;
case 3:
e_fi_ti=0x96;
e_fi_td=0xa5;
e_fd_ti=0x9a;
e_fd_td=0xa9;
e_fi_ti_b=4;
e_fi_td_b=2;
e_fd_ti_b=5;
e_fd_td_b=1;
break;
case 4:
e_fi_ti=0x9a;
e_fi_td=0xa6;
e_fd_ti=0x99;
e_fd_td=0xa5;
e_fi_ti_b=5;
e_fi_td_b=3;
e_fd_ti_b=6;
e_fd_td_b=2;
break;
case 5:
e_fi_ti=0x99;
e_fi_td=0x96;
e_fd_ti=0xa9;
e_fd_td=0xa6;
e_fi_ti_b=6;
e_fi_td_b=4;
e_fd_ti_b=1;
e_fd_td_b=3;
break;
case 6:
e_fi_ti=0xa9;
e_fi_td=0x9a;
e_fd_ti=0xa5;
e_fd_td=0x96;
e_fi_ti_b=1;
e_fi_td_b=5;

A.42
Appendixes.

e_fd_ti_b=2;
e_fd_td_b=4;
break;
}
switch(te_e)
{
case 0:
if ( mfs_e == 0 )
{ e1 = e_fd_td;
e1_b = e_fd_td_b; }
else
{ e1 = e_fi_td;
e1_b = e_fi_td_b; }
break;
case 1:
if ( mfs_e == 0 )
{ e1 = e0;
e1_b = 0; }
else
{ e1 = e0;
e1_b = 0;}
break;
case 2:
if ( mfs_e == 0 )
{ e1 = e_fd_ti;
e1_b = e_fd_ti_b; }
else
{ e1 = e_fi_ti;
e1_b = e_fi_ti_b;}
break;
}
/* needed for FLDTC */
if (e1_b == e1_b_1)
EQ=1;
else
EQ=0;
}
/************************************************************************/
/* End function: dtc */
/************************************************************************/
/************************************************************************/
/* flc_set_points */
/************************************************************************/
void flc_set_points (void)
/* MULTIPLY 0.683 FOR MOTOR 2 */
/* MULTIPLY 0.5 FOR 250us */
/* MULTIPLY 0.7 FOR 166us */

{ if (EQ == 0)
{
/* FLC1 */
te_err_i=(te_set-te)*0.31;
if (te_err_i > 1.4)
te_err_i = 1.4;
if (te_err_i < -1.4)
te_err_i = -1.4;

A.43
Appendixes.

index1=((te_err_i+0.1)/0.2)+7;
/* rd 2 degress */
/* fin2=(fin2*180/PI)+180+30;*/
angbisfloat=(angbisfloat*57.29)+210;
in2=angbisfloat/60;
angbisfloat=angbisfloat-60*in2;
if (angbisfloat > 60)
angbisfloat = 60;
if (angbisfloat < 0)
angbisfloat = 0;
index2= (angbisfloat+3)/6;
/* Wpc=wrrds*100/146; */

Wpc=wrrds*0.685;
if (Tpc >= Wpc)
{fin3=Tpc+Wpc+Wpc;
in2=mfs_e+10;
*pointerFI=in2;
}
else
{fin3=Tpc+Tpc+Wpc;
in2=mfs_e;
*pointerFI=in2;
}
if (fin3 > 280)
fin3 = 280;
if (fin3 < 100)
fin3 = 100;
/* index3=(fin3-100+7.5)/15;*/
index3=(fin3-92.5)/15;
/* count1=(11*13*index1)+(13*index2)+(index3);*/
count1=(143*index1)+(13*index2)+(index3);
*pointer_count1=count1;
*pointerEQ=0;
}
else
{
/* FLC2 */
te_err_i_1=(te_set-te_1)*0.31;
inc_te_i=(te-te_1)*0.31;
/* te_err_i_1=0.3;
inc_te_i=-0.5;*/
if ( inc_te_i > 0.7 )
inc_te_i = 0.7;
if (inc_te_i < -0.7)
inc_te_i = -0.7;
in1=(inc_te_i+0.025)/0.05+14;

if (te_err_i_1 > 0.7)


te_err_i_1 = 0.7;
if (te_err_i_1 < -0.7)
te_err_i_1 = -0.7;
in2=(te_err_i_1+0.025)/0.05+14;
count1=(29*in1)+in2;

*pointer_count1=count1;

A.44
Appendixes.

*pointer_dc_aux=dc_aux;
*pointerEQ=1;
}
}
/************************************************************************/
/* End function: flc_set_points */
/************************************************************************/

/************************************************************************/
/* Function : get_DC */
/************************************************************************/

void get_DC(void)
{ COUNTER++;
START=*pointerSTART;
if (START==1)
{
ERROR=ERROR+1;
ERROR_FLAG=1;
}
else
{
ERROR_FLAG=0;
if (EQ == 0)
{
DC=*pointerDCFLC1;
DC2=DC;
}
else
{
DC=*pointerDCFLC2;
DC2=DC;
/* inc_dc=*pointer_inc_dc;*/
}

}
/************************************************************************/
/* End get_DC */
/************************************************************************/

/************************************************************************/
/* Function : program_timer1 */
/************************************************************************/

void program_timer1(void)
{
/* 1ct=80ns=80e-9s. */
/* 125us=1562.5ct*/
/* 10us=8 % 125*/
/* dc=1 => all active state. 1562 ct.*/
/* dc=0.92 => 1437ct */
/* dc=0.08 => 125ct */
/* 3125 for 250us */

A.45
Appendixes.

/* 2083 fpr 166us */

if ( DC > 2000 )
{
/*do not program the timer 1. Do not enable its interrupt*/
/*stop the timer wherever it was*/
asm(" LDI @TIMECTRL,AR0");
asm(" LDI RSTCTRL,R0");
asm(" STI R0,*AR0");
/* send_active_state();*/
dc_aux=1.0;
}
else if ( ERROR_FLAG == 1)
{

DC=600;
/*program the timer*/
asm(" LDI @PERIOD,AR0");
asm(" LDI @_DC,R0");
asm(" STI R0,*AR0");
/*start the timer*/
asm(" LDI @TIMECTRL,AR0");
asm(" LDI SETCTRL,R0");
asm(" STI R0,*AR0");
/* send_active_state();*/
/* dc_aux=(600+1000)/2083.0;*/
dc_aux=0.768;
/*Enable timer 1 interupt */
asm(" OR 200h,IE");
}
else if ( DC< 1084)
{
/*do not program the timer 1. Do not enable its interrupt*/
/*stop the timer wherever it was*/
asm(" LDI @TIMECTRL,AR0");
asm(" LDI RSTCTRL,R0");
asm(" STI R0,*AR0");
/* SEND just a null state*/
asm(" LDI @_e0,R1");
asm(" LSH 16,R1");
asm(" LDI @posicio_DIO,AR1");
asm(" STI R1,*AR1");
/* dc_aux=1000/2083.0; */
dc_aux=0.48;

}
else
{
/* 70/166*2083 = 878 */
DC=DC2-1082;
/* DC=600; */
/*program the timer*/
asm(" LDI @PERIOD,AR0");
asm(" LDI @_DC,R0");
asm(" STI R0,*AR0");
/*start the timer*/

A.46
Appendixes.

asm(" LDI @TIMECTRL,AR0");


asm(" LDI SETCTRL,R0");
asm(" STI R0,*AR0");
/* send_active_state();*/
/* dc_aux=(DC+878)/2083.0;*/
dc_aux=DC2/2083.0;
/*Enable timer 1 interupt */
asm(" OR 200h,IE");
}
}
/************************************************************************/
/* End program_timer1 */
/************************************************************************/
/************************************************************************/
/* send_active_state */
/************************************************************************/
void send_active_state (void)
{
asm(" PUSH AR1");
asm(" PUSH R1");

asm(" LDI @_e1,R1");


asm(" LSH 16,R1");
/* as long as save_active_state is not used */
/* asm(" LDI @pointerdio,AR1");*/
/* asm(" LDI *AR1,R1");*/
asm(" LDI @posicio_DIO,AR1");
asm(" STI R1,*AR1");

asm(" POP R1");


asm(" POP AR1");
}
/************************************************************************/
/* End function: send_active_state */
/************************************************************************/

/************************************************************************/
/* Funcio : save_data_DPRAM (estimator) */
/* Retorna : res */
/************************************************************************/
void save_data_DPRAM (void)
{ float e1_b_aux,DC_b,te_aux;

sectbis_aux=sectbis*(-1);
e1_b_aux=e1_b*(-1);
DC_b=DC2/2083.0;
te_aux=te;

*pointerf0=te;
*pointerf1=te_e;
*pointerf2=dc_aux;
*pointerf3=e1_b_aux;
*pointerf4=sectbis_aux;
*pointerf5=mfs;
*pointerf6=mfs_e;

A.47
Appendixes.

*pointerf7=EQ;
/* *pointerf8=;
*pointerf9=;*/
/*10*/
/* *pointerfa=11;
*pointerf0=e1_b;
*pointerf1=sectbis_aux;
*pointerf2=te_e;
*pointerf3=mfs_e;
*pointerf4=te_set;
*pointerf5=fsD;
*pointerf6=fsQ;
*pointerf7=mfs;
*pointerf8=te;
*pointerf9=mfs_set;*/
/*10*/
/* *pointerfa=wrrds_1; */
/* *pointerfb=te;
*pointerfc=ang;
*pointerfd=sect;
*pointerfe=frD;
*pointerff=frQ;
*pointerf10=wrrds;
*pointerf11=isDdef;
*pointerf12=isQdef;
*pointerf13=ange2;*/
/*20*/
/* *pointer_FLAG = 1;*/
}
/************************************************************************/
/* End function: save_data_DPRAM */
/************************************************************************/

/************************************************************************/
/* Funcio : save_data_DPRAM_2 (estimator) */
/* Retorna : res */
/************************************************************************/

void save_data_DPRAM_2 (void)


{ float mfs_set_aux,mfs_aux,te_set_aux,te_aux,wrrds_aux;

mfs_set_aux=mfs_set*(-1);
mfs_aux=mfs*(-1);
te_set_aux=te_set;
te_aux=te;
wrrds_aux=wrrds/(-10);

*pointerf0=mfs_set_aux;
*pointerf1=mfs_aux;
*pointerf2=te_set_aux;
*pointerf3=te_aux;
*pointerf4=wrrds_aux;

}
/************************************************************************/

A.48
Appendixes.

/* End function: save_data_DPRAM_2 */


/************************************************************************/
/************************************************************************/
/* bit1 */
/************************************************************************/
void bit1 (void)
{
asm(" PUSH AR1");
asm(" PUSH R1");

asm(" LDI 0000h,R1");


asm(" LSH 16,R1");
asm(" LDI @posicio_DIO2,AR1");
asm(" STI R1,*AR1");

asm(" POP R1");


asm(" POP AR1");
}
/************************************************************************/
/* End function: bit1 */
/************************************************************************/
/************************************************************************/
/* bit0 */
/************************************************************************/
void bit0 (void)
{
asm(" PUSH AR1");
asm(" PUSH R1");

asm(" LDI 00ffh,R1");


asm(" LSH 16,R1");
asm(" LDI @posicio_DIO2,AR1");
asm(" STI R1,*AR1");

asm(" POP R1");


asm(" POP AR1");
}
/************************************************************************/
/* End function: bit0 */
/************************************************************************/

/************************************************************************/
/* Function : c_int10 (timer 1 interruption) */
/************************************************************************/
void c_int10(void)
{ /* disable int*/
asm(" ANDN 2000h,ST");
/* clean the int */
asm(" ANDN 200h,IF");
asm(" PUSH AR1");
asm(" PUSH R1");

/* stop the timer1 */


asm(" LDI @TIMECTRL,AR1");
asm(" LDI RSTCTRL,R1");
asm(" STI R1,*AR1");

A.49
Appendixes.

/* send the null state */


asm(" LDI @_e0,R1");
asm(" LSH 16,R1");
asm(" LDI @posicio_DIO,AR1");
asm(" STI R1,*AR1");

asm(" POP R1");


asm(" POP AR1");
}
/************************************************************************/
/* End c_int10 (timer 1 interruption) */
/************************************************************************/

/************************************************************************/
/* save_active_state */
/************************************************************************/
void save_active_state (void)
{ asm(" PUSH AR1");
asm(" PUSH R1");

asm(" LDI @pointerdio,AR1");


asm(" LDI @_e1,R1");
asm(" LSH 16,R1");
asm(" STI R1,*AR1");

asm(" POP R1");


asm(" POP AR1");
}
/************************************************************************/
/* End: save_active_state */
/************************************************************************/
/************************************************************************/
/* Inizialization tasks. Exectuted just once. */
/************************************************************************/

/************************************************************************/
/* Function: set_amd16qs */
/* It inizializates the board AM/D16QS. */
/*************************************************************************/
void set_amd16qs(void)
{
asm(" LDI @AMELIA0,AR0");

asm(" LDI 0010h,R0");


asm(" LSH 16,R0");
asm(" STI R0,*+AR0(DCR)");

/* reset AM/D16QS board*/


asm(" LDI 0000h,R0");
asm(" STI R0,*+AR0(CMR)");

asm(" STI R0,*+AR0(CFR)");

A.50
Appendixes.

/* User Control register config.*/


/* Value 28E3h: TCLK0 clk. factor 1/8 MCLK_0 and MCLK_1 as an output */

/*asm(" LDI 28E0h,R0");*/ /* /1 48 32 */


asm(" LDI 28E1h,R0"); /* /2 24 16 */
/*asm(" LDI 28E2h,R0");*/ /* /4 12 8 */
/*asm(" LDI 28E3h,R0");*/ /* /8 6 4 */

asm(" LSH 16,R0");


asm(" STI R0,*+AR0(CTR)");
/* Config. Serial Data Configuration Register */
/* 00c0h: Enable AMELIA2 */
asm(" LDI 00c0h,R0");
asm(" LSH 16,R0");
asm(" STI R0,*+AR0(SDC)");

/* Config. el Amelia Control Register */


/* Value 00F6h: out of reset, Master config., divide 384 */
/* enable chanals 2 i 3 and M_CLOCK_0 */

/*asm(" LDI 00F6h,R0");*/ /* 32 16 8 4 */


asm(" LDI 00E6h,R0"); /* 48 24 12 6 */

asm(" LSH 16,R0");


asm(" STI R0,*+AR0(CMR)");
/* Config. Configuration Register */
/* Value 8010h. It is cte */
asm(" LDI 8010h,R0");
asm(" LSH 16,R0");
asm(" STI R0,*+AR0(CFR)");

/* Config. Enhanced Configuration Register */


/* 00A0h: level int. It is reset either reading ISR */
/* or reading the channels */

asm(" LDI 00A0h,R0");

asm(" LSH 16,R0");


asm(" STI R0,*+AR0(ECFR)");

/* Config. Enhanced Control Register */


/* Value 0003h. AMELIA2 int. when buffer FIFO is 100% full*/

/*asm(" LDI 0000h,R0");*/ /* 25% */


/*asm(" LDI 0001h,R0");*/
/*asm(" LDI 0002h,R0");*/
asm(" LDI 0003h,R0"); /* 100% */
asm(" LSH 16,R0");
asm(" STI R0,*+AR0(ECTR)");

/* Config. Interrupt Mask Register */


/* Value 2000h int. when buffer if full at the specified % */
asm(" LDI 2000h,R0");
asm(" LSH 16,R0");
asm(" STI R0,*+AR0(IMR)");

A.51
Appendixes.

/* Wait loop calibration system */


/*asm(" LDI 0800h,R0");
asm(" LSH 13,R0");
asm("Calib_wait: SUBI 01h,R0");
asm(" BNZ Calib_wait");*/
asm(" LDI 0300h,R0");
asm(" LSH 15,R0");
asm("Calib_wait: SUBI 01h,R0");
asm(" BNZ Calib_wait");
/* Clean the FIFO (4 read for channel) */
asm(" LDI *+AR0(DR0),R0");
asm(" LDI *+AR0(DR1),R0");
asm(" LDI *+AR0(DR2),R0");
asm(" LDI *+AR0(DR3),R0");

asm(" LDI *+AR0(DR0),R0");


asm(" LDI *+AR0(DR1),R0");
asm(" LDI *+AR0(DR2),R0");
asm(" LDI *+AR0(DR3),R0");

asm(" LDI *+AR0(DR0),R0");


asm(" LDI *+AR0(DR1),R0");
asm(" LDI *+AR0(DR2),R0");
asm(" LDI *+AR0(DR3),R0");

asm(" LDI *+AR0(DR0),R0");


asm(" LDI *+AR0(DR1),R0");
asm(" LDI *+AR0(DR2),R0");
asm(" LDI *+AR0(DR3),R0");
/* Clean any int. (reading ISR) */
asm(" LDI *+AR0(ISR),R0");
}
/************************************************************************/
/* End function : set_amd16qs */
/************************************************************************/

/************************************************************************/
/* Function: set_amd16sa */
/* It inizializates the board AM/D16QS. */
/************************************************************************/
void set_amd16sa(void)
{
asm(" LDI @DCR1,AR0");
asm(" LDI @DCR1_DEF,R0");
asm(" STI R0,*AR0");

asm(" LDI @UCR,AR0");


asm(" LDI @UCR_DEF,R0");
asm(" STI R0,*AR0");

asm(" LDI @ACR,AR0");


asm(" LDI @ACR_DEF,R0");
asm(" STI R0,*AR0");

A.52
Appendixes.

asm(" LDI @TIMER1,AR0");


asm(" LDI @TIMER1_DEF,R0");
asm(" STI R0,*AR0");

asm(" LDI @CONFIG,AR0");


asm(" LDI @CONFIG_DEF,R0");
asm(" STI R0,*AR0");

asm(" LDI @IMR1,AR0");


asm(" LDI @IMR1_DEF,R0");
asm(" STI R0,*AR0");

}
/************************************************************************/
/* End function : set_amd16sa */
/************************************************************************/

/************************************************************************/
/* Funcio : dio32 */
/* Inizializates the DIO 32 */
/************************************************************************/
void dio32(void)
{

/* Dio32 as a master without any trigger */

/* asm(" LDI 0241h,R1");*/


asm(" LDI 023Ch,R1");
asm(" LSH 16,R1");
asm(" LDI @CONTROL,AR1");
asm(" STI R1,*AR1");

/* 32 bits as output */
asm(" LDI 1111h,R1");
asm(" LSH 16,R1");
asm(" LDI @PORTREG,AR1");
asm(" STI R1,*AR1");

/* disconnect the bridge */


asm(" LDI 00ffh,R1");
asm(" LSH 16,R1");
asm(" LDI @posicio_DIO,AR1");
asm(" STI R1,*AR1");

asm(" LDI 0000h,R1");


asm(" LSH 16,R1");
asm(" LDI @posicio_DIO2,AR1");
asm(" STI R1,*AR1");

/************************************************************************/
/* End function : dio_32 */
/************************************************************************/

A.53
Appendixes.

/************************************************************************/
/* Funcio : atn_table */
/* Creates a table with ATN values */
/************************************************************************/
void atn_table(void)
{
double s=0,r=0;
int k=0;

for(k=0;k<=100;k++)
{
r=atan(s);
table[k]=r;
s=s+0.01;
}
for(k=100;k<=200;k++)
{
s=k-99;
r=atan(s);
table[k]=r;
}
}

/************************************************************************/
/* End function : atn_table */
/************************************************************************/

A.54
Appendixes.

A.1.4 - PCTH1_9.c

/******************************************************************/
/* PCTH1_9: FLDTC 166us */
/***********************************************************************/

/* Needed C files */
#include <dos.h>
#include <math.h>
#include <conio.h>
#include "c:\mon32\bc45\tic32.h"
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
/* Memory DPRAM positions for the set points + exchange values */
#define FLAG 0x0c00009 // FLAG
#define COUNTER 0x0c0000a
#define HST_MFS 0xc0000bl // Flux set point_hst margin
#define HST_TE 0xc0000cl // Torque set point_hst margin
#define MFS 0xc0000dl // Flux set point
#define TE 0xc0000el // Torque set point
#define STOP 0xc00012l // SVM stop bit
/* Start obtaining the DC */
#define START 0xc00013l // SVM stop bit
/* Errors in obtaining the DC */
#define ERROR 0xc00014l // SVM stop bit
/* FLC1 references values */
#define FLUX_ANGLE_I 0x0c00015 /*Flux angle*/
#define TE_ERR_I 0x0c00016 /*Torque error i+1*/
#define WM 0x0c00017 /*Motor speed */
#define FI 0x0c00018 /*FI=0 flux decrease */
/*FI=1 increase */
/* FLC2 refernces values */

#define COUNT1 0x0c0001a /*Increment Torque error i+1*/


#define DC_AUX 0x0c0001d /* Last DC*/
#define INC_DC 0x0c0001e /* flc2 set point */
#define EQ 0x0c0001f
/* duty cycle */
#define DCFLC1 0x0c0001b /*Duty cycle from FLC1*/
#define DCFLC2 0x0c0001c /*Duty cycle from FLC2*/

#define f0 0xc00048l
#define f1 0xc00049l
#define f2 0xc0004al
#define f3 0xc0004bl
#define f4 0xc0004cl
#define f5 0xc0004dl
#define f6 0xc0004el
#define f7 0xc0004fl
#define f8 0xc00050l
#define f9 0xc00051l
/*10*/
#define fa 0xc00052l
#define fb 0xc00053l

A.55
Appendixes.

#define fc 0xc00054l
#define fd 0xc00055l
#define fe 0xc00056l
#define ff 0xc00057l
#define f10 0xc00058l
#define f11 0xc00059l
#define f12 0xc0005al
#define f13 0xc0005bl
/*20*/
#define f14 0xc0005cl
#define f15 0xc0005dl

#define PI 3.141592654

#define C_INC_DC 842


#define C_FI2 2150
#define C_FI2bis 2150
#define C_FD2 2150
#define C_FD2bis 2150

/* DSP file */
#define FILENAME "TH1_9.OUT"

/* Global variables */

char x;
int flg_err=0,q=0,r=0,j=0,k=0,i=0;
long int t=0;

/* Global adquisition variables */


float v0,v1,v2,v3,v4,v5,v6,v7,v8,v9,va,vb;
float vc,vd,ve,vf,v10,v11,v12,v13,v14,v15;

unsigned long stop=0,flag=0,counter=0,error=0,start=0;

/* set points */

float mfs_set=0,te_set=0,te_hst=0,mfs_hst=0;

/* FLDTC variables */
unsigned long dc2=3125,dc1=3125;
int eq,fi,index1,index2,index3,ct,in1,in2,in3,count, count1;
float Wpc,Tpc,fin1,fin2,fin3,data;
float dc_aux,inc_dc,duty_ratio=1;
float wmrds=0;

FILE *dades;

/*Array where the read file data is stored*/


float struct_INC_DC[C_INC_DC],struct_FI2[C_FI2],struct_FD2[C_FD2];
float struct_FI2bis[C_FI2bis],struct_FD2bis[C_FD2bis];
/* pointer file */

FILE *f_grf;

A.56
Appendixes.

/* data matrix */
float dt [5][300];
/* float dt [5][300];*/
/* Functions definition */
void Read_FLC(void);
void IniciDSP(void);
void Setpoints(void);
void EngegaDSP(void);
void ReadDPRAM(void);
void Savedata(void);
void Find_DC(void);
void AturaDSP(void);
void Data2file(void);

void main (void)


{
clrscr();
printf("\nPress '1' to start\n");
x = getch();
if (x=='1')
{
Read_FLC();
IniciDSP();
delay(500);
Setpoints();
delay (500);
EngegaDSP();
delay (500);
for(t=0; t<500000 ; t++)
{
delay(0.01);
r++;
Get_DPRAM_Word_32(START,&start);
if (start == 1 )
{
Find_DC();
start=0;
Put_DPRAM_Word_32(START,start);
/* for(q=0; q<10 ; q++)
{
}
q=0;*/
/* Get_DPRAM_Word_32(FLAG,&flag);
if (flag == 1 )
{ */
if ( j <= 299 && r > 20000)
{

ReadDPRAM();
Savedata(); /* Store the data array */
j++;
}
/* }
/* else
{

A.57
Appendixes.

flg_err++;
} */
}
}
}
AturaDSP();
printf("\nEND ");
delay(2000);
Get_DPRAM_Word_32(ERROR,&error);
printf("\nThe number of errors is %li",error);
Get_DPRAM_Word_32(COUNTER,&counter);
printf("\nThe number of times is %li",counter);
printf("\nThe number of flag real errors is %i",flg_err);

Data2file();
getche();
}

/******************************************************************/
/* DSP inizialization */
/******************************************************************/
void IniciDSP(void)
{
/* Seleccio data type for the DSP */
Set_Processor_Data_Type_Size_32();

/* DSP Inicialitzation. Board adress (0x290), DPRMA adress (0xD00)*/


/* bus ISA size */
Select_Board(0x290, 0xd00, 8);

/* Enable DPRAM */
Enable_DPRAM();

/* DSP reset */
Global_Reset();

/* Load the file to be executed */


Load_Object_File(FILENAME);

}
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/* End of DSP inizialization */
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/

/******************************************************************/
/* Engega DSP */
/******************************************************************/
void EngegaDSP(void)
{ stop=0;
Put_DPRAM_Word_32(STOP, stop);
/* Run file */
Run_From(Get_Entry_PC());
delay(2000);
}
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/

A.58
Appendixes.

/* End Engega DSP */


/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/

/******************************************************************/
/* Setpoints */
/******************************************************************/
void Setpoints(void)
{ double mfs_sug=0,te_set_d=0;

printf("\n\nTorque setpoint N/m: ");


scanf("%f", &te_set);
Put_DPRAM_Float_32(TE,te_set);
Tpc=te_set*100/9.8;
printf("Torque set point hst margin: ");
scanf("%f", &te_hst);
Put_DPRAM_Float_32(HST_TE,te_hst);

te_set_d=te_set;
/* because squared value */
/* mfs_sug=(0.3665*sqrt(te_set_d)*0.3665*sqrt(te_set_d));
printf("\nThe suggested optimized flux square value is %lf \n",
mfs_sug);*/

mfs_sug=0.3665*sqrt(te_set_d);
printf("\nThe suggested optimized flux value is %lf \n", mfs_sug);
printf("\nFlux set point: ");
scanf("%f", &mfs_set);
/* mfs_set=1.05;*/
Put_DPRAM_Float_32(MFS,mfs_set);
printf("Flux set point hst margin: ");
scanf("%f", &mfs_hst);
Put_DPRAM_Float_32(HST_MFS,mfs_hst);

}
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/* End setpoints */
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/

/******************************************************************/
/* Read DPRAM */
/******************************************************************/

void ReadDPRAM(void)
{
Get_DPRAM_Float_32(f0,&v0);
Get_DPRAM_Float_32(f1,&v1);
Get_DPRAM_Float_32(f2,&v2);
Get_DPRAM_Float_32(f3,&v3);
Get_DPRAM_Float_32(f4,&v4);
/*Get_DPRAM_Float_32(f5,&v5);
Get_DPRAM_Float_32(f6,&v6);
Get_DPRAM_Float_32(f7,&v7);
/*Get_DPRAM_Float_32(f8,&v8);
Get_DPRAM_Float_32(f9,&v9);
/*10*/

A.59
Appendixes.

/*Get_DPRAM_Float_32(fa,&va);
Get_DPRAM_Float_32(fb,&vb);
Get_DPRAM_Float_32(fc,&vc);
Get_DPRAM_Float_32(fd,&vd);
Get_DPRAM_Float_32(fe,&ve);
Get_DPRAM_Float_32(ff,&vf);
Get_DPRAM_Float_32(f10,&v10);
Get_DPRAM_Float_32(f11,&v11);
Get_DPRAM_Float_32(f12,&v12);
Get_DPRAM_Float_32(f13,&v13); */
/*20*/
/*Get_DPRAM_Float_32(f14,&v14);
Get_DPRAM_Float_32(f15,&v15);*/

}
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/* End read DPRAM */
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/

/******************************************************************/
/* Savedata */
/******************************************************************/

void Savedata(void)
{
dt[0][j]=v0;
dt[1][j]=v1;
dt[2][j]=v2;
dt[3][j]=v3;
dt[4][j]=v4;
/*dt[5][j]=v5;
dt[6][j]=v6;
dt[7][j]=v7;
/*dt[8][j]=v8;
dt[9][j]=v9;
/*10*/
/*dt[10][j]=va;
dt[11][j]=vb;
dt[12][j]=vc;
dt[13][j]=vd;
dt[14][j]=ve;
dt[15][j]=vf;
dt[16][j]=v10;
dt[17][j]=v11;
dt[18][j]=v12;
dt[19][j]=v13;*/
/*20*/
/*dt[20][j]=v14;
dt[21][j]=v15;*/
}
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/* End save data */
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/******************************************************************/
/* Find_DC */

A.60
Appendixes.

/******************************************************************/
void Find_DC(void)
{
Get_DPRAM_Word_32(EQ,&eq);

if (eq == 0)
{
/* FLC1 */
Get_DPRAM_Word_32(COUNT1,&count1);
Get_DPRAM_Word_32(FI,&fi);

/* fi=1 and Tpc >=Wpc 10. Total fi=11*/


/* fi=0 and Tpc >=Wpc 10. Total fi=10*/
/* fi=1 and Tpc < Wpc 00. Total fi=01*/
/* fi=0 and Tpc < Wpc 00. Total fi=00*/

if (fi == 11)
duty_ratio=struct_FI2[count1];
else if (fi == 1)
duty_ratio=struct_FI2bis[count1];
else if (fi == 10)
duty_ratio=struct_FD2[count1];
else
duty_ratio=struct_FD2bis[count1];

/* if (duty_ratio < 0.45 )


duty_ratio=0.45;
if (duty_ratio > 0.55)
duty_ratio=0.55;*/

/* 83us=1041,666667ct 125us=1562.5ct 166us=2083.33ct 250us=3125ct */


dc1=duty_ratio*2083;
if (dc1<1850)
dc1=1850;
Put_DPRAM_Word_32(DCFLC1,dc1);
}
else
{
/* FLC2 */
Get_DPRAM_Word_32(COUNT1,&count1);
Get_DPRAM_Float_32(DC_AUX,&dc_aux);
inc_dc=struct_INC_DC[count1];
duty_ratio=inc_dc+dc_aux;
/* if (duty_ratio < 0.2 )
duty_ratio=0.2;
if (duty_ratio > 0.85)
duty_ratio=0.85;*/
dc2=duty_ratio*2083;
if (dc2<1850)
dc2=1850;

Put_DPRAM_Word_32(DCFLC2,dc2);
/* Put_DPRAM_Float_32(INC_DC,inc_dc); */
}
}
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/

A.61
Appendixes.

/* End Find_DC */
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/

/******************************************************************/
/* Stop DSP */
/******************************************************************/
void AturaDSP(void)
{ stop=1;
Put_DPRAM_Word_32(STOP, stop);
}
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/* End stop DSP */
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/

/******************************************************************/
/* Data2file */
/******************************************************************/
void Data2file(void)
{
if ((f_grf = fopen("\\FLDTC11.GRF", "w")) == 0)
{
printf("Unable to open file");
return;
}
else
{
for(k=0;k<j;k++)
{
/* fprintf(f_grf, "%e %e %e %e %e %e %e
%e\n",dt[0][k],dt[1][k],dt[2][k],dt[3][k],dt[4][k],dt[5][k],dt[6][k],dt[7][
k]);*/
fprintf(f_grf, " %e %e %e %e
%e\n",dt[0][k],dt[1][k],dt[2][k],dt[3][k],dt[4][k]);
}
fclose(f_grf);
}
}
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/* End Data2file */
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/

/******************************************************************/
/* Read_FLC */
/******************************************************************/
void Read_FLC(void)
{ clrscr();
count=0;
count1=0;
data=0;
/*open the file (it must be in the root */
dades=fopen("INC_DC.txt","rt");

/*while not file end*/


while (!feof(dades))
{
fscanf(dades,"%f",&data); /* read file float */

A.62
Appendixes.

struct_INC_DC[count]=data; /* save it to the structure */


/*printf("\nThe input %d of the file, is %f",count,data); */
count++;
}
fclose(dades); /*the file is closed*/

printf("\nThe file INC_DC has %d inputs",count);


/* The data from the structures is shown */
/* while (count1<count)
{
printf("\nThe data input %d of the struct is
%f",count1,estructura[count1]);
count1++;
} */

/* Second file*/

count=0;
count1=0;
data=0;
/*open the file (it must be in the root */
dades=fopen("FD2.txt","rt");

/*while not file end*/


while (!feof(dades))
{
fscanf(dades,"%f",&data); /* read file float */
struct_FD2[count]=data; /* save it to the structure */
/*printf("\nThe input %d of the file, is %f",count,data); */
count++;
}
fclose(dades); /*the file is closed*/

printf("\nThe file FD2 has %d inputs",count);

/* Third file*/

count=0;
count1=0;
data=0;
/*open the file (it must be in the root */
dades=fopen("FI2.txt","rt");

/*while not file end*/


while (!feof(dades))
{
fscanf(dades,"%f",&data); /* read file float */
struct_FI2[count]=data; /* save it to the structure */
/*printf("\nThe input %d of the file, is %f",count,data); */
count++;
}
fclose(dades); /*the file is closed*/

printf("\nThe file FI2 has %d inputs",count);

/* Fourth file*/

A.63
Appendixes.

count=0;
count1=0;
data=0;
/*open the file (it must be in the root */
dades=fopen("FD2bis.txt","rt");

/*while not file end*/


while (!feof(dades))
{
fscanf(dades,"%f",&data); /* read file float */
struct_FD2bis[count]=data; /* save it to the structure */
/*printf("\nThe input %d of the file, is %f",count,data); */
count++;
}
fclose(dades); /*the file is closed*/

printf("\nThe file FD2bis has %d inputs",count);

/* Fifth file*/

count=0;
count1=0;
data=0;
/*open the file (it must be in the root */
dades=fopen("FI2bis.txt","rt");

/*while not file end*/


while (!feof(dades))
{
fscanf(dades,"%f",&data); /* read file float */
struct_FI2bis[count]=data; /* save it to the structure */
/*printf("\nThe input %d of the file, is %f",count,data); */
count++;
}
fclose(dades); /*the file is closed*/
printf("\nThe file FI2bis has %d inputs",count);
}
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/* End Read_FLC */
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/

A.64
Appendixes.

A.2 - Fuzzy rules.


A.2.1 - FLC 1.
The Fuzzy Logic controller 1 system comprises four groups of rules, each of which contains
46 rules (see section 3.2.1). Two of them are used when the stator flux is smaller than its
reference value (Flux increase) and the other two in the opposite case (Flux decrease). In any
case just one fuzzy system is used per iteration, and it depends on the working point.
All four groups of 46 rules are listed below.

A.65
Appendixes.

A.2.1.1 - Flux increase, Wpc<Tpc.


1. If (t-e is n-l) and (s-f-p is s) and (T+2w is s) then (dc is vl) (1)
2. If (t-e is n-l) and (s-f-p is m) and (T+2w is s) then (dc is vl) (1)
3. If (t-e is n-l) and (s-f-p is l) and (T+2w is s) then (dc is m) (1)
4. If (t-e is n-m) and (s-f-p is s) and (T+2w is s) then (dc is s) (1)
5. If (t-e is n-m) and (s-f-p is m) and (T+2w is s) then (dc is s) (1)
6. If (t-e is n-m) and (s-f-p is l) and (T+2w is s) then (dc is s) (1)
7. If (t-e is n-s) and (s-f-p is s) and (T+2w is s) then (dc is z) (1)
8. If (t-e is n-s) and (s-f-p is m) and (T+2w is s) then (dc is z) (1)
9. If (t-e is n-s) and (s-f-p is l) and (T+2w is s) then (dc is z) (1)
10. If (t-e is s) and (s-f-p is s) and (T+2w is s) then (dc is s) (1)
11. If (t-e is s) and (s-f-p is m) and (T+2w is s) then (dc is s) (1)
12. If (t-e is s) and (s-f-p is l) and (T+2w is s) then (dc is s) (1)
13. If (t-e is m) and (s-f-p is s) and (T+2w is s) then (dc is s) (1)
14. If (t-e is m) and (s-f-p is m) and (T+2w is s) then (dc is m) (1)
15. If (t-e is m) and (s-f-p is l) and (T+2w is s) then (dc is m) (1)
16. If (t-e is l) then (dc is vl) (1)
17. If (t-e is n-l) and (s-f-p is s) and (T+2w is m) then (dc is vl) (1)
18. If (t-e is n-l) and (s-f-p is m) and (T+2w is m) then (dc is vl) (1)
19. If (t-e is n-l) and (s-f-p is l) and (T+2w is m) then (dc is l) (1)
20. If (t-e is n-m) and (s-f-p is s) and (T+2w is m) then (dc is s) (1)
21. If (t-e is n-m) and (s-f-p is m) and (T+2w is m) then (dc is s) (1)
22. If (t-e is n-m) and (s-f-p is l) and (T+2w is m) then (dc is s) (1)
23. If (t-e is n-s) and (s-f-p is s) and (T+2w is m) then (dc is m) (1)
24. If (t-e is n-s) and (s-f-p is m) and (T+2w is m) then (dc is m) (1)
25. If (t-e is n-s) and (s-f-p is l) and (T+2w is m) then (dc is m) (1)
26. If (t-e is s) and (s-f-p is s) and (T+2w is m) then (dc is m) (1)
27. If (t-e is s) and (s-f-p is m) and (T+2w is m) then (dc is m) (1)
28. If (t-e is s) and (s-f-p is l) and (T+2w is m) then (dc is l) (1)
29. If (t-e is m) and (s-f-p is s) and (T+2w is m) then (dc is m) (1)
30. If (t-e is m) and (s-f-p is m) and (T+2w is m) then (dc is l) (1)
31. If (t-e is m) and (s-f-p is l) and (T+2w is m) then (dc is l) (1)
32. If (t-e is n-l) and (s-f-p is s) and (T+2w is l) then (dc is vl) (1)
33. If (t-e is n-l) and (s-f-p is m) and (T+2w is l) then (dc is vl) (1)
34. If (t-e is n-l) and (s-f-p is l) and (T+2w is l) then (dc is vl) (1)
35. If (t-e is n-m) and (s-f-p is s) and (T+2w is l) then (dc is vl) (1)
36. If (t-e is n-m) and (s-f-p is m) and (T+2w is l) then (dc is z) (1)
37. If (t-e is n-m) and (s-f-p is l) and (T+2w is l) then (dc is z) (1)
38. If (t-e is n-s) and (s-f-p is s) and (T+2w is l) then (dc is vl) (1)
39. If (t-e is n-s) and (s-f-p is m) and (T+2w is l) then (dc is vl) (1)
40. If (t-e is n-s) and (s-f-p is l) and (T+2w is l) then (dc is vl) (1)
41. If (t-e is s) and (s-f-p is s) and (T+2w is l) then (dc is vl) (1)
42. If (t-e is s) and (s-f-p is m) and (T+2w is l) then (dc is vl) (1)
43. If (t-e is s) and (s-f-p is l) and (T+2w is l) then (dc is vl) (1)
44. If (t-e is m) and (s-f-p is s) and (T+2w is l) then (dc is vl) (1)
45. If (t-e is m) and (s-f-p is m) and (T+2w is l) then (dc is vl) (1)
46. If (t-e is m) and (s-f-p is l) and (T+2w is l) then (dc is vl) (1)

A.66
Appendixes.

A.2.1.2 - Flux increase, Wpc>Tpc.


1. If (t-e is n-l) and (s-f-p is s) and (2T+w is s) then (dc is vl) (1)
2. If (t-e is n-l) and (s-f-p is m) and (2T+w is s) then (dc is vl) (1)
3. If (t-e is n-l) and (s-f-p is l) and (2T+w is s) then (dc is m) (1)
4. If (t-e is n-m) and (s-f-p is s) and (2T+w is s) then (dc is s) (1)
5. If (t-e is n-m) and (s-f-p is m) and (2T+w is s) then (dc is s) (1)
6. If (t-e is n-m) and (s-f-p is l) and (2T+w is s) then (dc is s) (1)
7. If (t-e is n-s) and (s-f-p is s) and (2T+w is s) then (dc is z) (1)
8. If (t-e is n-s) and (s-f-p is m) and (2T+w is s) then (dc is z) (1)
9. If (t-e is n-s) and (s-f-p is l) and (2T+w is s) then (dc is z) (1)
10. If (t-e is s) and (s-f-p is s) and (2T+w is s) then (dc is s) (1)
11. If (t-e is s) and (s-f-p is m) and (2T+w is s) then (dc is s) (1)
12. If (t-e is s) and (s-f-p is l) and (2T+w is s) then (dc is s) (1)
13. If (t-e is m) and (s-f-p is s) and (2T+w is s) then (dc is s) (1)
14. If (t-e is m) and (s-f-p is m) and (2T+w is s) then (dc is m) (1)
15. If (t-e is m) and (s-f-p is l) and (2T+w is s) then (dc is m) (1)
16. If (t-e is l) then (dc is vl) (1)
17. If (t-e is n-l) and (s-f-p is s) and (2T+w is m) then (dc is vl) (1)
18. If (t-e is n-l) and (s-f-p is m) and (2T+w is m) then (dc is vl) (1)
19. If (t-e is n-l) and (s-f-p is l) and (2T+w is m) then (dc is l) (1)
20. If (t-e is n-m) and (s-f-p is s) and (2T+w is m) then (dc is s) (1)
21. If (t-e is n-m) and (s-f-p is m) and (2T+w is m) then (dc is s) (1)
22. If (t-e is n-m) and (s-f-p is l) and (2T+w is m) then (dc is s) (1)
23. If (t-e is n-s) and (s-f-p is s) and (2T+w is m) then (dc is m) (1)
24. If (t-e is n-s) and (s-f-p is m) and (2T+w is m) then (dc is m) (1)
25. If (t-e is n-s) and (s-f-p is l) and (2T+w is m) then (dc is m) (1)
26. If (t-e is s) and (s-f-p is s) and (2T+w is m) then (dc is m) (1)
27. If (t-e is s) and (s-f-p is m) and (2T+w is m) then (dc is m) (1)
28. If (t-e is s) and (s-f-p is l) and (2T+w is m) then (dc is l) (1)
29. If (t-e is m) and (s-f-p is s) and (2T+w is m) then (dc is m) (1)
30. If (t-e is m) and (s-f-p is m) and (2T+w is m) then (dc is l) (1)
31. If (t-e is m) and (s-f-p is l) and (2T+w is m) then (dc is l) (1)
32. If (t-e is n-l) and (s-f-p is s) and (2T+w is l) then (dc is vl) (1)
33. If (t-e is n-l) and (s-f-p is m) and (2T+w is l) then (dc is vl) (1)
34. If (t-e is n-l) and (s-f-p is l) and (2T+w is l) then (dc is vl) (1)
35. If (t-e is n-m) and (s-f-p is s) and (2T+w is l) then (dc is vl) (1)
36. If (t-e is n-m) and (s-f-p is m) and (2T+w is l) then (dc is z) (1)
37. If (t-e is n-m) and (s-f-p is l) and (2T+w is l) then (dc is z) (1)
38. If (t-e is n-s) and (s-f-p is s) and (2T+w is l) then (dc is vl) (1)
39. If (t-e is n-s) and (s-f-p is m) and (2T+w is l) then (dc is vl) (1)
40. If (t-e is n-s) and (s-f-p is l) and (2T+w is l) then (dc is vl) (1)
41. If (t-e is s) and (s-f-p is s) and (2T+w is l) then (dc is vl) (1)
42. If (t-e is s) and (s-f-p is m) and (2T+w is l) then (dc is vl) (1)
43. If (t-e is s) and (s-f-p is l) and (2T+w is l) then (dc is vl) (1)
44. If (t-e is m) and (s-f-p is s) and (2T+w is l) then (dc is vl) (1)
45. If (t-e is m) and (s-f-p is m) and (2T+w is l) then (dc is vl) (1)
46. If (t-e is m) and (s-f-p is l) and (2T+w is l) then (dc is vl) (1)

A.67
Appendixes.

A.2.1.3 - Flux decrease, Wpc<Tpc.


1. If (t-e is n-l) and (s-f-p is s) and (T+2w is s) then (dc is m) (1)
2. If (t-e is n-l) and (s-f-p is m) and (T+2w is s) then (dc is vl) (1)
3. If (t-e is n-l) and (s-f-p is l) and (T+2w is s) then (dc is vl) (1)
4. If (t-e is n-m) and (s-f-p is s) and (T+2w is s) then (dc is z) (1)
5. If (t-e is n-m) and (s-f-p is m) and (T+2w is s) then (dc is z) (1)
6. If (t-e is n-m) and (s-f-p is l) and (T+2w is s) then (dc is s) (1)
7. If (t-e is n-s) and (s-f-p is s) and (T+2w is s) then (dc is z) (1)
8. If (t-e is n-s) and (s-f-p is m) and (T+2w is s) then (dc is z) (1)
9. If (t-e is n-s) and (s-f-p is l) and (T+2w is s) then (dc is z) (1)
10. If (t-e is s) and (s-f-p is s) and (T+2w is s) then (dc is s) (1)
11. If (t-e is s) and (s-f-p is m) and (T+2w is s) then (dc is s) (1)
12. If (t-e is s) and (s-f-p is l) and (T+2w is s) then (dc is s) (1)
13. If (t-e is m) and (s-f-p is s) and (T+2w is s) then (dc is m) (1)
14. If (t-e is m) and (s-f-p is m) and (T+2w is s) then (dc is m) (1)
15. If (t-e is m) and (s-f-p is l) and (T+2w is s) then (dc is s) (1)
16. If (t-e is l) then (dc is vl) (1)
17. If (t-e is n-l) and (s-f-p is s) and (T+2w is m) then (dc is l) (1)
18. If (t-e is n-l) and (s-f-p is m) and (T+2w is m) then (dc is vl) (1)
19. If (t-e is n-l) and (s-f-p is l) and (T+2w is m) then (dc is vl) (1)
20. If (t-e is n-m) and (s-f-p is s) and (T+2w is m) then (dc is z) (1)
21. If (t-e is n-m) and (s-f-p is m) and (T+2w is m) then (dc is z) (1)
22. If (t-e is n-m) and (s-f-p is l) and (T+2w is m) then (dc is z) (1)
23. If (t-e is n-s) and (s-f-p is s) and (T+2w is m) then (dc is m) (1)
24. If (t-e is n-s) and (s-f-p is m) and (T+2w is m) then (dc is m) (1)
25. If (t-e is n-s) and (s-f-p is l) and (T+2w is m) then (dc is m) (1)
26. If (t-e is s) and (s-f-p is s) and (T+2w is m) then (dc is vl) (1)
27. If (t-e is s) and (s-f-p is m) and (T+2w is m) then (dc is m) (1)
28. If (t-e is s) and (s-f-p is l) and (T+2w is m) then (dc is l) (1)
29. If (t-e is m) and (s-f-p is s) and (T+2w is m) then (dc is vl) (1)
30. If (t-e is m) and (s-f-p is m) and (T+2w is m) then (dc is l) (1)
31. If (t-e is m) and (s-f-p is l) and (T+2w is m) then (dc is m) (1)
32. If (t-e is n-l) and (s-f-p is s) and (T+2w is l) then (dc is vl) (1)
33. If (t-e is n-l) and (s-f-p is m) and (T+2w is l) then (dc is vl) (1)
34. If (t-e is n-l) and (s-f-p is l) and (T+2w is l) then (dc is vl) (1)
35. If (t-e is n-m) and (s-f-p is s) and (T+2w is l) then (dc is vl) (1)
36. If (t-e is n-m) and (s-f-p is m) and (T+2w is l) then (dc is vl) (1)
37. If (t-e is n-m) and (s-f-p is l) and (T+2w is l) then (dc is z) (1)
38. If (t-e is n-s) and (s-f-p is s) and (T+2w is l) then (dc is vl) (1)
39. If (t-e is n-s) and (s-f-p is m) and (T+2w is l) then (dc is vl) (1)
40. If (t-e is n-s) and (s-f-p is l) and (T+2w is l) then (dc is vl) (1)
41. If (t-e is s) and (s-f-p is s) and (T+2w is l) then (dc is vl) (1)
42. If (t-e is s) and (s-f-p is m) and (T+2w is l) then (dc is vl) (1)
43. If (t-e is s) and (s-f-p is l) and (T+2w is l) then (dc is vl) (1)
44. If (t-e is m) and (s-f-p is s) and (T+2w is l) then (dc is vl) (1)
45. If (t-e is m) and (s-f-p is m) and (T+2w is l) then (dc is vl) (1)
46. If (t-e is m) and (s-f-p is l) and (T+2w is l) then (dc is vl) (1)

A.68
Appendixes.

A.2.1.4 - Flux decrease, Wpc>Tpc.


1. If (t-e is n-l) and (s-f-p is s) and (2T+w is s) then (dc is m) (1)
2. If (t-e is n-l) and (s-f-p is m) and (2T+w is s) then (dc is vl) (1)
3. If (t-e is n-l) and (s-f-p is l) and (2T+w is s) then (dc is vl) (1)
4. If (t-e is n-m) and (s-f-p is s) and (2T+w is s) then (dc is z) (1)
5. If (t-e is n-m) and (s-f-p is m) and (2T+w is s) then (dc is z) (1)
6. If (t-e is n-m) and (s-f-p is l) and (2T+w is s) then (dc is s) (1)
7. If (t-e is n-s) and (s-f-p is s) and (2T+w is s) then (dc is z) (1)
8. If (t-e is n-s) and (s-f-p is m) and (2T+w is s) then (dc is z) (1)
9. If (t-e is n-s) and (s-f-p is l) and (2T+w is s) then (dc is z) (1)
10. If (t-e is s) and (s-f-p is s) and (2T+w is s) then (dc is s) (1)
11. If (t-e is s) and (s-f-p is m) and (2T+w is s) then (dc is s) (1)
12. If (t-e is s) and (s-f-p is l) and (2T+w is s) then (dc is s) (1)
13. If (t-e is m) and (s-f-p is s) and (2T+w is s) then (dc is m) (1)
14. If (t-e is m) and (s-f-p is m) and (2T+w is s) then (dc is m) (1)
15. If (t-e is m) and (s-f-p is l) and (2T+w is s) then (dc is s) (1)
16. If (t-e is l) then (dc is vl) (1)
17. If (t-e is n-l) and (s-f-p is s) and (2T+w is m) then (dc is l) (1)
18. If (t-e is n-l) and (s-f-p is m) and (2T+w is m) then (dc is vl) (1)
19. If (t-e is n-l) and (s-f-p is l) and (2T+w is m) then (dc is vl) (1)
20. If (t-e is n-m) and (s-f-p is s) and (2T+w is m) then (dc is z) (1)
21. If (t-e is n-m) and (s-f-p is m) and (2T+w is m) then (dc is z) (1)
22. If (t-e is n-m) and (s-f-p is l) and (2T+w is m) then (dc is z) (1)
23. If (t-e is n-s) and (s-f-p is s) and (2T+w is m) then (dc is m) (1)
24. If (t-e is n-s) and (s-f-p is m) and (2T+w is m) then (dc is m) (1)
25. If (t-e is n-s) and (s-f-p is l) and (2T+w is m) then (dc is m) (1)
26. If (t-e is s) and (s-f-p is s) and (2T+w is m) then (dc is vl) (1)
27. If (t-e is s) and (s-f-p is m) and (2T+w is m) then (dc is m) (1)
28. If (t-e is s) and (s-f-p is l) and (2T+w is m) then (dc is l) (1)
29. If (t-e is m) and (s-f-p is s) and (2T+w is m) then (dc is vl) (1)
30. If (t-e is m) and (s-f-p is m) and (2T+w is m) then (dc is l) (1)
31. If (t-e is m) and (s-f-p is l) and (2T+w is m) then (dc is m) (1)
32. If (t-e is n-l) and (s-f-p is s) and (2T+w is l) then (dc is vl) (1)
33. If (t-e is n-l) and (s-f-p is m) and (2T+w is l) then (dc is vl) (1)
34. If (t-e is n-l) and (s-f-p is l) and (2T+w is l) then (dc is vl) (1)
35. If (t-e is n-m) and (s-f-p is s) and (2T+w is l) then (dc is vl) (1)
36. If (t-e is n-m) and (s-f-p is m) and (2T+w is l) then (dc is vl) (1)
37. If (t-e is n-m) and (s-f-p is l) and (2T+w is l) then (dc is z) (1)
38. If (t-e is n-s) and (s-f-p is s) and (2T+w is l) then (dc is vl) (1)
39. If (t-e is n-s) and (s-f-p is m) and (2T+w is l) then (dc is vl) (1)
40. If (t-e is n-s) and (s-f-p is l) and (2T+w is l) then (dc is vl) (1)
41. If (t-e is s) and (s-f-p is s) and (2T+w is l) then (dc is vl) (1)
42. If (t-e is s) and (s-f-p is m) and (2T+w is l) then (dc is vl) (1)
43. If (t-e is s) and (s-f-p is l) and (2T+w is l) then (dc is vl) (1)
44. If (t-e is m) and (s-f-p is s) and (2T+w is l) then (dc is vl) (1)
45. If (t-e is m) and (s-f-p is m) and (2T+w is l) then (dc is vl) (1)
46. If (t-e is m) and (s-f-p is l) and (2T+w is l) then (dc is vl) (1)

A.69
Appendixes.

A.2.2 - FLC 2.
The fuzzy logic controller 2 system contains 37 rules (see section 3.2.2).
All 37 rules are listed below.
1. If (inc-Te is n-l) then (inc-dc is vl) (1)
2. If (inc-Te is n-m) and (E-Te-ant is n-l) then (inc-dc is s) (1)
3. If (inc-Te is n-m) and (E-Te-ant is n-m) then (inc-dc is m) (1)
4. If (inc-Te is n-m) and (E-Te-ant is n-s) then (inc-dc is l) (1)
5. If (inc-Te is n-m) and (E-Te-ant is s) then (inc-dc is l) (1)
6. If (inc-Te is n-m) and (E-Te-ant is m) then (inc-dc is l) (1)
7. If (inc-Te is n-m) and (E-Te-ant is l) then (inc-dc is vl) (1)
8. If (inc-Te is n-s) and (E-Te-ant is n-l) then (inc-dc is n-s) (1)
9. If (inc-Te is n-s) and (E-Te-ant is n-m) then (inc-dc is n-s) (1)
10. If (inc-Te is n-s) and (E-Te-ant is n-s) then (inc-dc is z) (1)
11. If (inc-Te is n-s) and (E-Te-ant is s) then (inc-dc is s) (1)
12. If (inc-Te is n-s) and (E-Te-ant is m) then (inc-dc is m) (1)
13. If (inc-Te is n-s) and (E-Te-ant is l) then (inc-dc is l) (1)
14. If (inc-Te is z) and (E-Te-ant is n-l) then (inc-dc is n-m) (1)
15. If (inc-Te is z) and (E-Te-ant is n-m) then (inc-dc is n-m) (1)
16. If (inc-Te is z) and (E-Te-ant is n-s) then (inc-dc is n-s) (1)
17. If (inc-Te is z) and (E-Te-ant is s) then (inc-dc is z) (1)
18. If (inc-Te is z) and (E-Te-ant is m) then (inc-dc is s) (1)
19. If (inc-Te is z) and (E-Te-ant is l) then (inc-dc is m) (1)
20. If (inc-Te is s) and (E-Te-ant is n-l) then (inc-dc is n-l) (1)
21. If (inc-Te is s) and (E-Te-ant is n-m) then (inc-dc is n-m) (1)
22. If (inc-Te is s) and (E-Te-ant is n-s) then (inc-dc is n-s) (1)
23. If (inc-Te is s) and (E-Te-ant is s) then (inc-dc is n-s) (1)
24. If (inc-Te is s) and (E-Te-ant is m) then (inc-dc is z) (1)
25. If (inc-Te is s) and (E-Te-ant is l) then (inc-dc is s) (1)
26. If (inc-Te is m) and (E-Te-ant is n-l) then (inc-dc is n-vl) (1)
27. If (inc-Te is m) and (E-Te-ant is n-m) then (inc-dc is n-l) (1)
28. If (inc-Te is m) and (E-Te-ant is n-s) then (inc-dc is n-m) (1)
29. If (inc-Te is m) and (E-Te-ant is s) then (inc-dc is n-m) (1)
30. If (inc-Te is m) and (E-Te-ant is m) then (inc-dc is n-s) (1)
31. If (inc-Te is m) and (E-Te-ant is l) then (inc-dc is n-s) (1)
32. If (inc-Te is l) and (E-Te-ant is n-l) then (inc-dc is n-vl) (1)
33. If (inc-Te is l) and (E-Te-ant is n-m) then (inc-dc is n-vl) (1)
34. If (inc-Te is l) and (E-Te-ant is n-s) then (inc-dc is n-vl) (1)
35. If (inc-Te is l) and (E-Te-ant is s) then (inc-dc is n-vl) (1)
36. If (inc-Te is l) and (E-Te-ant is m) then (inc-dc is n-l) (1)
37. If (inc-Te is l) and (E-Te-ant is l) then (inc-dc is z) (1)

A.70
Appendixes.

A.3 - Experimental motor drive pictures.

A.3.1 - Workbench. Induction motor_1.5kW. DC motor.

Figure A.1. It is shown the entire workbench with the encoder, DC motor,
AC motor_1.5kW and the dynamometer.

Figure A.2. Encoder and DC motor detail. It should be remembered that the DC
motor works as a generator, i.e. as a load.

A.71
Appendixes.

( Next page shows figures A.3 and A.4 ).

A.72
Appendixes.

Figure A.3. AC motor_1.5kW and dynamo detail.

A.3.2 - Resistors.

Figure A.4. Resistors used as a load of the DC generator.

A.73
Appendixes.

( Next page shows figures A.5 and A.6 ).

A.74
Appendixes.

A.3.3 - Voltage Source Inverter.

Figure A.5. It is shown the Voltage Source Inverter with its protections board and
signal adaptation board.

A.3.4 - Workstation.

Figure A.6. It is shown the entire workstation.

A.75

S-ar putea să vă placă și