Development of Field Oriented Vector Controller for an Induction Motor Using Matlab Embedded Coder_2015
Development of Field Oriented Vector Controller for an Induction Motor Using Matlab Embedded Coder_2015
by
BHANU BABAIAHGARI
Master of Science
Electrical Engineering
2015
ProQuest Number: 1605080
In the unlikely event that the author did not send a complete manuscript
and there are missing pages, these will be noted. Also, if material had to be removed,
a note will indicate the deletion.
ProQuest 1605080
Published by ProQuest LLC (2015). Copyright of the Dissertation is held by the Author.
ProQuest LLC.
789 East Eisenhower Parkway
P.O. Box 1346
Ann Arbor, MI 48106 - 1346
This thesis for the Master of Science degree by
Bhanu Babaiahgari
by
Tim Lei
Yiming Deng
ii
Babaiahgari, Bhanu (M.S., Electrical Engineering)
Development of Field Oriented vector controller for an induction motor using Matlab
embedded coder
ABSTRACT
In this thesis project, a field oriented vector control system for an induction motor
point of view, the TMS320F28335 DSP is selected as the digital controller of the vector
control system. All the required peripheral and interfacing circuits are developed for
the three-phase inverter control, signal measurement and for system protection as well.
and next it is tested by speed PI controller. At the stage of the controller design,
The simulation results meet the design specifications well. When the control system
is verified by simulations, the DSP evaluation board is programmed using the file
generated by embedded coder (Simulink Tool) and tested. The test results show that
the current regulator and speed regulator are able to control the stator current and
the conventional approach and the one used in this project. The results show that
the approach used in this project has higher efficiency and flexibility in terms of
development time.
The form and content of this abstract are approved. I recommend its publication.
iii
Approved: Jaedo Park
iv
ACKNOWLEDGMENT
I would like to express my deepest thanks to my advisor, Dr. Jae Do Park, for
his valuable guidance and suggestions he has given me in this project. Without him,
this would have been impossible. Also, I thank the committee members, Dr. Tim Lei
and Dr. Yiming Deng for spending their vaulable time for reviewing this report and
attending my defense.
I would like to express gratitude to my mother Samanthakamani(Chitti) and my
father Nagaraju for their encouragement and support throughout the project.
I would also like to thank Muahnnad Alaraj for explaining some of the topics
related to this project.
v
DEDICATION
vi
TABLE OF CONTENTS
Chapter
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3.3.4 Anti-windup . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.6 Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.7 Discretization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
vii
4. DSP Programming and CCS V5.5 . . . . . . . . . . . . . . . . . . . . . . . 26
4.3.1 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4.3.2 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
viii
5.3.2 Analysis on Results . . . . . . . . . . . . . . . . . . . . . . . 60
6.1 Introduction to C . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
6.1.2 Drawbacks of C . . . . . . . . . . . . . . . . . . . . . . . . . . 62
7. Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Appendix
A.1 Simulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
A.2 Waveforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
ix
LIST OF TABLES
Table
x
LIST OF FIGURES
Figure
5.1 Step response of the d and q currents.Fig(a) is the step response of the d
current with a reference of 80mA, and fig(b) is the step response of the q
5.2 Response in q current due to a step in i current. Fig. (a) shows q current
with respect to step in d current and Fig. (b) shows q current with respect
6.2 Illustration of two different approaches that can be used in the project . 64
A.5 (a) shows Stator voltages in abc reference frame and (b) shows Stator
A.7 (a) shows Stator currents in abc reference frame and (b) shows Stator
xii
A.9 Theta varying from −Π to +Π . . . . . . . . . . . . . . . . . . . . . . . 74
xiii
1. Introduction
1.1 Background
AC (Alternating Current) motors have a simple structure and has higher efficiency
than the DC motors when operated at a high speed [6]. In the past, due to convenience
of torque and speed control, the DC machine had been used widely for adjustable
speed drive (ASD). However, recently, with the development of power electronics
technology, the AC machine drive system such as the induction machine and the
are being used. AC machines do not have the commutator and brush of DC machine,
which need regular maintenance are the weak points of a DC machine. AC motors
also provide more durable service with a lower cost compared to DC motors. Besides,
AC motors can easily be supplied directly from the grid and therefore they are widely
used in the industry. And this trend shift from DC machine to AC machine has
been continued because of the development of not only the previously mentioned
power electronics but also the control theory of AC machine such as field orientation
control.
is needed, which is usually done with three phase inverter. With feedback orientation,
control methods can be applied to control parameters like speed, torque, currents to
obtain good transient performance [7]. This method of controlling the transformed
algorithms.
1
1.2 Objectives
The main objective of this project is to design and implement sensored vector
machine. Also, designing an experimental setup for the students to access the entire
project is part of the task. The approach used in this project is much easier to
understand and implement the system. In the past, the programming was usually
done in C language, which requires an expert knowledge in C. But the approach used
in this project is entirely done in Matlab/Simulink, the software that many people
use in these days to reduce the time to implement the system. The final outcome of
evaluation board.
1.3 Scope
The contents of this project covers many academic and practical areas, such as
programming, debugging, analog and digital circuit design and construction, induc-
2
2. Induction Machine Vector Control System Description
The basic overview of induction machine vector control system used in this project
is shown in Fig. 2.1. The vector control system includes a few hardware devices
namely induction machine and inverter, and technical theory such as vector control
strategy and Pulse Width Modulation (PWM). Details about the different parts will
3
2.1 AC Induction Machine
An induction or asynchronous machine is an AC electric motor in which the
induction from the magnetic field of the stator winding. An induction motor therefore
does not require mechanical commutation. An induction motor’s rotor can be either
wound type or squirrel-cage type [8]. The induction machine is composed of a stator
and a rotor as shown in Fig. 2.2(a) and Fig. 2.2(b). The stator is fixed while the
rotor rotates inside with a small air gap between them. The rotor contains conductor
bars and end rings as shown in Fig. 2.2(b). The rotor cage is a closed conductor
as the conductor bars are all short-circuited by the end rings. The rotor is mounted
on the shaft with two bearings [8]. Normally one of the two shaft ends is used for
driving the load while the other one for mounting the shaft position or the speed
measurement devices. The stator is made up of several pole pairs. Each pole pair
has three windings placed symmetrically in space as shown in Fig. 2.2(a). Based on
the arrangement of the three windings, the flux linkages (ΨA ,ΨB and ΨC ) generated
by the windings have 120 displacement in space. The magnitudes of flux linkages
where us (t) is the applied voltage to each winding, R is the resistance of each winding
and is (t) is the current through each winding. If a three phase voltage is applied on
tively, this will result in a sinusoidal flux linkage in each phase that lags the phase
4
voltage by 90 if the winding resistance is neglected, that is
2π
ΨB (t) = Ψpk sin(2πf t + ) (2.6)
3
4π
ΨC (t) = Ψpk sin(2πf t + ) (2.7)
3
The waveforms of the three currents are shown in Fig. 2.3(a). In each period, the
current from each winding reaches its maximum value once. As shown the Fig.
2.3(b), the resultant flux can be obtained by adding the three flux linkages and has
the magnitude of resultant flux vector doesn’t change and it rotates with a constant
magnitude. The rotation of the rotor can be seen in Fig. 2.3(c). The magnitude of
this rotating flux vectro is 1.5 times of the peak value of each winding’s flux linkage.
The rotating speed Ns (in rpm) of the resultant flux is called synchronous speed,
calculated as
f
Ns = 120 × (2.8)
P
Where f is three phase voltage frequency and P is number of poles.
The rotating resultant stator flux linkage cuts the rotor bars, which will induce a
voltage in the rotor bars. Since the rotor bars are short-circuited, this induced voltage
will drive a current in the rotor bars. By Lenzs law, An induced current is always in
such a direction as to oppose the motion or change producing it, the induced current
will generate a torque trying to make the rotor follow the rotating flux generated
by the stator windings. However, if the rotor speed is exactly equal to synchronous
speed, there will not be an induced current and hence no torque. Other external
factors like friction torque and load torque will make the rotor slow down. So the
induction machine rotor runs at a slightly slower speed than the synchronous speed
in order to get enough induced current and driving torque. There always exists a gap
5
between machine speed and synchronous speed, which is referred to as slip. This is
nating voltage. From the orcad schematic of three-phase inverter shown in Fig. 2.4,
it can be seen that the three-phase inverter is fed by a DC voltage as the energy
input and has three parts, each containing two IGBTs and two diodes. Consider the
DC-link voltage fed into the three-phase inverter as Vdc . For phase A, if U1 is turned
on, the phase voltage relative to ground will be equal to +Vdc /2; while if switch U2
Though it seems like the three-phase inverter only can generate two possible
voltage values for phase voltage, +Vdc /2 or Vdc /2, Pulse Width Modulation(PWM)
6
makes it possible to for the three-phase inverter to convert the DC-link voltage to
three-phase alternating voltage by controlling the on-times and off-times of the IG-
BTs. By adjusting the proportion of on-time in one PWM switching period for the
same bridge, any value between +Vdc /2 and Vdc /2 can be obtained as the phase volt-
age. The ratio of on time and the total on and off time is described as duty cycle and
wave (carrier wave) and a sine wave (reference wave) shown in Fig. 2.5. When the
magnitude of the sine wave is larger than the triangular wave, the PWM signal will
output a high voltage level to switch on the corresponding IGBT. On the contrary,
when the magnitude of the sine wave is smaller than the triangular wave, the PWM
7
signal will produce a low voltage level to turn off the IGBT. This process is illustrated
in Fig. 2.6. Hence the corresponding time moments of the intersections of the two
waves serve as the turning points to switch on or off the IGBT in the inverter.
CAD software is performed. The reference voltages for the three phases are assumed
to be constant and DC-link voltage is 220V. The loads of the inverter are assumed to
drive (VFD) control method where the stator currents of a three-phase AC electric
motor are identified as two orthogonal components that can be visualized with a vec-
tor. One component defines the magnetic flux of the motor, the other the torque. The
8
main advantage of vector control system is it gets rid of machine speed dependency
on power grid frequency and make it possible to reach desired machine speed within
safety and power limits, although it gives rise to a considerable complex computation
Normally, in a vector control system, the phase currents of the machine and
machine speed are taken as control system inputs, and phase voltages to the machine
are taken as outputs. Two important transformations involved in the vector control
namely Clarke Transformation and Park Transformation. The three phase sinusoidal
quantities can be easily transformed into DC quantities in steady state using both
the transformations.
displacement as shown in Fig. 2.6(a), and the sum of the phase currents amplitude is
zero (ia (t)+ib (t)+ic (t) = 0), neglecting the zero sequence currents, the instantaneous
three-phase currents can be expressed by an equivalent space current vector i~a , with
2
i~s (t) = (ia (t) + ib (t)ej2Π/3 + ic (t)ej4Π/3 ) (2.10)
3
√
2 1 1 3
= (ia (t) − ib (t) − ic (t) + j (ib (t) − ic (t))) (2.11)
3 2 2 2
= iα + iβ (2.12)
where constant 2/3 is placed in order to make the two-phase quantities to have the
same amplitude as the three-phase quantities. As can be seen from the Fig. 2.6(a),
the α-axis of the αβ coordinate system is aligned with the direction of the A-phase
space vector. As the αβ coordinate system is stationary with respect to the coils and
the coils are fixed to the stator, the αβ coordinate system is stationary as well.
9
(a) (b)
is named as Clarke Transformation. The reverse process that turns three-phase back
If you notice the α and the β components of these rotating vectors, you could
see that they are still AC sinusoidal quantities. Therefore a new coordinate system
is defined, called the dq coordinate system, which has the same origin as the αβ
coordinate system but it rotates with the speed we specify. Usually we rotate dq
coordinate system with the same speed as flux rotates to make the imaginary part
achieved by multiplying the vector by e−jθ , where θ is the angle between the two
coordinate system. As seen in the Fig. 2.6(b), the αβ coordinate system has been
10
transformed to dz coordinate system. The transformation can be explained as:
Park Transformation while its reverse process is called Inverse Park Transformation,
which is explained in the next section. If the vector notation is expressed in terms of
mation are the reverse process of the transformations discussed above. This inverse
transformations are required in the vector control theory [9] to transform the modified
The same theory discussed above applies to the inverse transformation theory
The Inverse Park Transformation can be derived from equation 2.14 as:
From the above equations, the Inverse Park Transformation can be expressed in
12
3. Vector Control Design for Machine Control
This chapter discusses about designing the controller blocks namely flux estima-
tions, current regulators and speed regulators, that have to be undergone succeeding
be identified for setting the gains of the regulators, limiting values of the limiters of
the controller, reference and feed-forwarding values to the regulator, and so on. In
general, the parameters of the machine are determined using locked rotor test or by
the no-load test. But, in actual operating conditions, these values might vary widely.
The following sections discuss briefly about the vector control system.
[10] based on the extra tests or name plate data of the machinery are introduced.
Though the method based on an extra test provides reasonably accurate parameters,
the methods may need some tools to apply the test signals or special setup for the
L2m e dieds Lm
Vdse = (Rs + Rr 2
)ids + σLs − ωe σLs ieqs − Rr 2 λedr (3.1)
Lr dt Lr
L2m e dieqs Lm e
Vqse = (Rs + Rr )iqs + σLs + ωe σLs ieds + ωr λ (3.2)
Lr2 dt Lr dr
Based on some approximations done at near rated operating speed with no load, the
In this mode of operation, we have Vqse Vdse . Therefore the peak of the phase
voltage can be approximated as Vqse . Hence the rated flux can be calculated from the
13
rated voltage and rated frequency of the induction machine. This is done by simply
dividing the peak of the rated phase voltage by the rated angular frequency,λe of the
machine.
approximated as
L2m
σLs = Ls − (3.4)
Lr
It is to be noted that, the transient inductance varies with the magnitude and the
frequency of the current flowing through the inductance. If the stator transient induc-
tance is not accurately measured, the torque of the machine might lead to oscillatory
pulse to the induction machine through a PWM inverter as shown in Fig. 3.1. The
Fig. 3.2 shows the flow of current in the circuit. In this test, the phase voltage
dias dias
Vas = (Rs + Rr )ias + (Lls + Llr ) = (Rs + Rr )ias + σLs (3.5)
dt dt
If the width of the voltage pulse is small enough compared to the stator time constant
σLs
defined as T = Rs +Rr
, most of the voltage will be applied to the stator transient
dias
Vas = σLs (3.6)
dt
t2 − t1
σLs = Vad (3.7)
ias (t2 ) − ias (t1 )
14
3.1.3 Mutual Inductance, Lm
The mutual inductance of a machine can be identified easily if no-load operation
is possible for the system. In this case, by simply measuring the phase current and
the phase voltage, the sum of the stator leakage reactance and the mutual reactance
can be obtained by dividing voltage by the current. Then the mutual inductance
the assumption that the stator leakage inductance is much smaller than the mutual
inductance. Note that the operating frequency should be near the rated value to
reduce the error due to the resistance voltage drop of the stator winding. The mutual
inductance of the machine varies according to the magnitude of the rotor flux linkage
decided by the magnitude of the d-axis current of the synchronous reference frame.
vectors. Although there are many dynamic models of the machine, we use T model
defined in the stationary αβ system in this manual. The equivalent circuit in the
form of T-circuit [11] is shown in Fig. 3.1 From the circuit shown above, the stator
15
and rotor dynamic equations can be derived as,
dψ~s
V~s = Rs i~s + (3.8)
dt
dψ~r
V~r = 0 = Rr i~r + − jωr ψ~r (3.9)
dt
where the stator and rotor flux linkage equations can be written as,
3 Lm
Te = ×P × × Imag(ψ~s∗ ∗ i~s ) (3.12)
2 Lr
ψ~s = ψsα + jψsβ : Stator flux linkage Lls : Stator leakage inductance
ψ~r = ψrα + jψrβ : Rotor flux linkage Llr : Rotor leakage inductance
Te : Torque
anti-windup. The Fig. 3.2 shows the complete structure of a current regulator. The
• ~is,ref , calculated from the reference value of the torque and the rotor flux.
16
Figure 3.2: Overview of Current Regulator
• i~s , the stator current in dq- coordinates, which is obtained from the transfor-
• The angular speed and the magnitude of the rotor flux, which are calculated by
• Stator voltage saturated by the voltage limiter. This limited voltage is then
transformed using Inverse Clarke and Park and then taken to the inverter and
17
3.3.1 Current Reference
The current reference term can be derived from the rotor side equation in the
0 = Rr ierd + pψrd
e e
− (ω − ωr )ψrq (3.13)
e
where p is the differential term. Since the term ψrq = 0, the equation above can be
written as
e
pψrd = Rr ierd (3.14)
e
ψrd − Lm iesd
ierd = (3.15)
Lm
Using both the above two equations and considering a single-order delay system i.e.
L2m e dieqs Lm e
Vqse = (Rs + Rr 2 )iqs + σLs + ωe σLs ieds + ωr λ (3.17)
Lr dt Lr dr
It could be found that the last term and last but one term need to be removed in
order to get a linear relation between voltage and the current. The first term in the
relation is usually known as the resistive voltage drop and the second term in the
relation is known as the inductive voltage drop. The existence of the third term in
the relation introduces the cross-coupling between d and q components. Also the
fourth term comprises of back-emf turns. Since the coupling and back- emf turns are
not expected during the current regulator design, a feed forward signal is applied to
18
3.3.3 Voltage Limiter
As we know based on the principle of the three-phase inverter and PWM, the
amplitude of the equivalent sinusoidal voltage applied to the machine should be lim-
ited to the half of the DC-link voltage. This limitation of the voltage can be done by
using voltage limiter. This can be seen in the Fig. 3.2 It should also be noted that
the amplitude of the modulation voltage is expected to be smaller than the half of the
DC-link voltage because he inverter will output a constant voltage if the magnitude
of the modulation voltage is larger than half DC-link voltage. In this project, as
the DC-link voltage is 48V, the peak value of the phase voltage is set to be within
+20V or -20V. Even after you transform the DC vectors to three-phase sinusoidal
quantities, the peak value of the three-phase quantity remain the same and will never
3.3.4 Anti-windup
There are some instances where, the output voltage of the current regulator may
not reach the value which is needed due to the existence of the voltage limiter. Then
the current error between the reference current and the feedback might let the inte-
grator of the PI regulator integrate to a very large value. Even if the error is finally
reduced, it would still take long time for the integrator to come to normal value,
which gives a delay [13] in the signal. This phenomenon is called integrator windup
problem. In order to overcome this situation, the difference between the voltage val-
ues before and after the voltage limiters fed back to the integrator through some gain
which makes the integrator reset [14] every time and eliminates the integrator windup
problem.
estimator. The structure of an example flux estimator can be seen in Fig. 3.3. The
19
Figure 3.3: Structure of Flux estimator
current model estimator, is more suitable for low speed application despite of sensitiv-
ity to parameter variations [15] rather than the voltage model estimator. As a result,
the flux estimator used in this project is the current model estimator implemented
in Indirect Field Orientation, which indicates that the quantities used for the flux
estimation are currents taken from the d − q system. With the stator d and q currents
and the electrical rotor angular speed as inputs, the flux determination equations for
dψR RR
= RR id − ψR (3.18)
dt LM
where ω1 − ωr is the difference speed between the synchronous speed and the electri-
cal rotor speed, the slip frequency. The Fig.3.3 illustrates the structure of the flux
estimator.
20
3.5 Speed Regulator
The dynamic equation of the mechanical part of the induction motor can be
expressed as
dωr B Te − TL
= − ωr + (3.20)
dt J J
where
TL : Load torque
B : Friction coefficient
J : Motor Inertia
The speed regulator design is very similar to the current regulator design. Like in
current regulator design, the speed regulator also has the anti-windup setup. But
this regulator does not have any feed forward terms but has the current limiter alike
voltage limiter in current control regulator. The current limiter has the peak value
21
of the rated current of the machine since the machine operating current should not
exceed the rated machine current. To avoid large overshoots in the speed response,
anti-windup is added. The structure of the speed regulator is shown in Fig. 3.4
The speed regulator has the output of torque reference which can be converted to
q-current, which acts on the motor immediately and directly. Since the inner current
loop has a very high bandwidth, the speed loop should have smaller bandwidth.
3.6 Simulation
The designated vector control system is implemented or simulated in Mat-
lab/Simulink. The block diagram of the vector control design is same as the figure
shown before and the structures of sub-blocks of the current regulator, flux estimator
and speed regulator are almost the same as shown in the previous figures. But some-
times in Simulink, the integrator block as well as the limiter block does not accept
the complex values. Therefore, the complex number is split into real and imaginary
part, which are then dealt separately. This process is illustrated in the Fig. 3.5 For
the limiter, the complex number is expressed in polar form, and then the magnitude
of the limiter is saturated as shown in Fig. 3.6 In the entire stages of simulation,
the whole vector control system is built with Simulink blocks. The advantages of
building the model with Simulink blocks is that it is very easy to observe a variable
22
Figure 3.6: Saturation of the complex number in simulink
system structure.
3.7 Discretization
All the design above is based on continuous time. But the DSP does not allow
to execute the continuous time varying signals. Therefore, the signals of each block
have to be discretized for the proper execution of DSP. For example, if the control
loop period is 0.1msec, the sampling period h for the discretized system is selected as
0.1msec. At a certain time instant t = kh, in one cycle of the control loop sampling
takes place firstly, then the sampled values at t = kh are passed down in to the
function block chain. Then each block takes its input signals and stored state variables
into calculation, derives its output to feed into the next block and then get its state
system into discrete system. With x(t) defined as a continuous variable, x(kh) as its
value at the current time instant and x[(k + 1)h] for the next time instant, as shown
in Fig. 3.7 the derivatives can be approximated with a forward difference as [13]
23
Figure 3.7: Forward Euler approximation
The integral form of Forward Euler approximation is shown in Fig. 3.8, where the
area below the curve x(t) can be approximated to the integral of variable x, denoted
as X. Over the interval between kh and (k + 1)h, the area below the curve of x(t) is
approximated to the area of the rectangle with x(kh) and h as dimension of it. The
24
integral of x(t) can be calculated as, by using the Forward Euler approximation,
All the equations which are continuous time varying signals are presented in integral
form using Forward Euler approximation. For the blocks containing dynamic parts
like integrals, the above equation should be used into the original equations to replace
25
4. DSP Programming and CCS V5.5
The integrated interface for any user developing code in C language in this project
is the Code Composer Studio v5.5. Code Composer Studio (CCS) [16] is the Inte-
integrated solution called the ControlSU IT E [17] which consists of all the header
files, source files, libraries, linker command files for executing a program. Also the
Code Composer Studio has many extensive examples and example codes that might
The design of induction motor vector control is shown in Fig. 4.1. There are some
modifications and assumptions, however, in the actual design, during the implemen-
tation. Some of the modifications are firstly, only two phase currents are measured
instead of all the three phases. It is sufficient to take the measurements of two phases
for the Clarke Transformation, if the three phase currents are balanced with the con-
dition of ia (t) + ib (t) + ic (t) = 0 [18]. If three phases are balanced, one phase can be
calculated from the other two phases. At the start if the testing, first, V/F control
is implemented in order to test the motor functionality and the Simulink [19] blocks.
The flow chart of the various steps that the DSP undergoes after implementing the
code is shown in Fig. 4.2. The program, as shown in figure, starts with variables dec-
larations, initializations and configuration of the used hardware in the DSP, start-up
of the inverter and offset measurement. The latter process is in the implementation
in the hardware but the starting process depends on the software. After the DSP
is configures, the PWM sequence is started and the program enters in to loop. In
this project, the control strategy is designed such that, the control loop is synchro-
nized with the PWM carrier wave. Every start of PWM period will trigger an ADC
sequence. The ADC sequence consists of eight channels, which are used to measure
phase currents, fault currents and fault voltages and DC link voltages. At the end
of ADC sequence, the program jumps into measuring the current and speed values,
26
Figure 4.1: Programming Design
where the offset compensation is added. Following the measurement calculations, the
vector control algorithm is executed. Finally, the PWM duty cycles are updated with
the new calculated values and the program then waits for the next trigger from the
PWM. In the following sections, brief introduction to the F28335 DSP is given and
also description about the hardware modules are given. In this section, introduction
to the DSP F28335 is briefly studied, followed by the modules description and also the
features of DSP. The PWM module plays an important role in this project because
of its functioning to output the three-phase signals to the inverter, decide the control
loop period and to synchronize the ADC. This is the reason why more details are
and a single-precision 32-bit floating-point unit (FPU), which enables the floating-
point computation to be performed in the hardware. Also the CPU of the F28335
has a 8-stage pipeline structure, which makes the CPU be able to execute eight
27
Figure 4.2: Flow chart of the program
instructions simultaneously on one system clock period. The 150MHz system clock is
provided by an on-chip oscillator and a phase-locked loop (PLL) circuit. The oscillator
generates 50MHz clock signal, which is tripled to 150 MHz by the PLL circuit. The
F28335 has independent logical memory spaces and separated memory buses for the
program and the data as seen in Fig. 4.3. The memory bus consists of a program read
bus, a data read bus and data write bus. The physical memory of the F28335 consists
28
and the registers. The ROM has been pre-programmed by the DSP manufacturer.
The program existing in the ROM has a standard programming procedure for DSP
booting as well as some optimized codes for the mathematical functions. The registers
control the behavior of the DSP and each peripheral module. For the F28335, reading
from or writing to registers applies the bit-field address structures. F28335 also has
the feature of direct memory access (DMA). With the DMA bus, the data can be
passed from one part of the DSP to the other part without the interaction of the
CPU, which increases the data transmission speed. Since it is designed mainly for
applications like ours, the F28335 has plenty of peripheral circuits. For instance,
in our project, the motor vector control uses 16-channel, 12-bit ADC module, the
PWM module and the encoder module. Also there are different communications that
could be achieved with the F28335, which are controller area network (CAN) module,
the serial communication interface (SCI) module, the serial peripheral interface (SPI),
the multichannel buffered serial port (McBSP) module and the inter-integrated circuit
(I2C) module. F28335, also, supports 96 interrupts. These interrupts are governed by
the peripheral interrupt expansion (PIE) block, which helps in enabling or disabling
the interrupts, decide the interrupt priorities and inform the CPU of the occurrence of
a new interrupt. The F28335 has the joint test action group (JTAG) interface, which
helps us in real-time debugging. With the help of this JTAG, anyone can look and
modify the contents of the memory and the registers without stopping the processor.
bit address to the MUX. The relations between the channels and the 4-bit addresses
are listed in Table. 4.1. From the Fig. 4.9, we can observe that the analog MUX
29
Figure 4.3: Block diagram of ADC module [1]
consists of two 8-to-1 multiplexers, MUX1 and MUX2. The outputs from the two
multiplexers are connected to two sample and hold (S/H) circuits, S/H-A and S/H-B,
respectively. The two S/H circuits allow the possibility of sampling two analog signal
simultaneously. After the S/H circuit has done the sampling, the analog-to-digital
converter begins to transfer the analog signal held on the S/H circuit into a 12-bit
binary number. The entire functioning of the ADC is governed by the ADC control
registers. There are sequencer blocks in the ADC, Sequencer1 and Sequencer2. These
two sequencers are then merged into a cascaded sequencer, where maximum sixteen
channels can be selected. These two sequencers are placed in an appropriate order and
each sequencer maximum of eight channels can be selected. In order to start an ADC
or cascaded sequencer, the SOC signal could be given by the PWM module or the
bit S/W, which can be set or reset in the software. Sequencer1 and the cascaded
Channel S3 S2 S1 S0 Channel S3 S2 S1 S0
input/output (GPIO) pin. The ADC clock frequency decides the time to take for one
conversion. The ADC clock is obtained by prescaling the system clock. This is done
in default if you set the DSP as F28335. The total prescaling factor is equal to the
product of the prescaling factors of the high-speed prescalar, the ADC clock prescalar
and the extra prescalar. The conversion results will be will be written into the result
registers, through a result selection MUX. For each sequence, the result selection
MUX will send the first conversion result to Result Reg0, the second one to Result
Reg1 and so on, until this sequence is finished. Whenever the complex conversions
occur like analog-to-digital conversions are needed in two different moments during
one control, the dual-sequence mode can be applied. In this project, all the analog
signals are sampled at the same moment and the number of analog signals is less
than eight. Due to this, one sequence of conversion per control loop is enough. But
cascaded mode of operation is still applied, which can leave flexibility to the channels
and DSP pins assignment. Sometimes it is required that all the analog signals are
31
Figure 4.4: ADC module configuration setup in this project [1]
sampled at exactly when the PWM carrier wave reaches its peak. But since there
are only two S/H circuits, in the practical implementation, the two phase currents
phase A and phase B are sampled firstly and then the other parameters are sampled.
The sampling mode of the ADC module should be simultaneous. The ADC clock
frequency is better to be high, from the point of conversion speed. But too high ADC
clock frequency might cause some non-linearity to the conversion results [21]. So
12.5MHz, the highest ADC clock frequency is recommended and is being set in this
project. Another issue that might be noticed is the width of the sampling window,
which is defined as the number of clocks that the S/H circuit spends on sampling the
signal. For the signals that change very slowly, a wider sampling window might work
perfect bringing the advantage of removing the noise by averaging the input signal.
But in this project, since the currents change very fast, wide sampling does not
32
work, instead smallest sampling window of one ADC clock is applied. Then the ADC
module should work in start/stop mode, which means that the conversion is started
by the SOC signal and stops when the sequence is finished, waiting for the next SOC
signal. The SOC signal is triggered by the PWM module. Finally, an interrupt service
routine has to be generated by the ADC, once the sequence is finished. The vector
control algorithm will be executed in the Interrupt Service Routines (ISR). The block
diagram based on the ADC module configurations described above in the theory is
shown in Fig. 4.10. In simultaneous sampling mode, a pair of conversions counts for
one. Also the ADC counts from 0 instead of 1, so the value of the M AXCON V should
be calculated as
N o.of Conversions
M AXCON V = [ ]−1 (4.1)
2
This section explains about PWM module.
enhanced PWM means that it can generate complex PWM waveform with the least
CPU resources occupied [22]. Each of the ePWM module has two output channels:
ePWMxA and ePWMxB belonging to the ePWMx module. Each ePWM module
contains seven submodules, which can realize different functions in the generation
chopper (PC) submodule, trip zone (TZ) submodule and event-trigger (ET) submod-
ule. The Fig. 4.4 shows the complete structure of a single ePWM module with each
submodule between the subsections. In this project, not all but some of them are
used for various accomplishments. The following sections will briefly describe the
ePWM modules individually to get a clear idea of how the ePWM functions.
33
Figure 4.5: Block Diagram of F28335 [2]
own ePWM module. The structure and block diagram of the time-base submodule
containing registers is shown in Fig. 4.4. The main function of the time-base sub-
module is to find the PWM time-base block relative to the system clock. The PWM
time-base clock is to regulate the timing of all the events in the PWM module. The
system clock period is defined as TSY SCLKOU T and the time-base clock is defined as
TT BCLK . The time-base clock period can be scaled to many times of the system clock
34
period as:
where CLKDIV and HSP CLKDIV are bits in the time-base control register
The time-base submodule is also used to specify the period of the time-base
counter (TBCTR) depending in which mode it is operating. There are three modes
of operation for the time-base submodule, which can be selected in time-base control
register (TBCTL), namely up-count mode, down-count mode and up-down mode. In
the first mode and the second mode, TBCTR always keep incrementing or decre-
menting all the time giving a saw tooth carrier wave. But the third one i.e. up-down
mode, the TBCTR increments in the first half of the PWM period and then decre-
ments the second half part of the PWM period giving a triangular carrier wave. The
main difference of the up-down mode is that in one period the counter changes in a
symmetrical fashion, where the corresponding movement to the PWM carrier peak
time is easily found. The peak time of the PWM carrier wave has to be known for
signal sampling and that is the reason why up-down mode count mode is used in this
project. To obtain the desired PWM frequency, the value in time-base period regis-
TP W M = 2 × T BP RD × TT BCLK (4.3)
1
fP W M = (4.4)
TP W M
where TP W M stands for PWM period and TT BCLK for time-base clock period. From
the above relations, the value in the time-base period register can be determined as
follows
1 fSY SCLKOU T
T BP RD = × (4.5)
2 fP W M × CLKDIV × HSP CLKDIV
35
Therefore the only parameters that have be known to compute TBPRD are DSP
system clock frequency and the desired PWM frequency. The parameters that have
been used in this project for the configuration of DSP are PWM frequency of 10
kHz and the system clock frequency of the DSP F28335 is 150MHz. The values for
CLKDIV and HSPLCLKDIV, used in this project are 1 and 1 for convenience. From
the above equation, the value set in the time-base period register can be calculated
alternating voltage, hence the synchronization between the three-phase PWM signals
is very important. Each ePWM module has two signal for synchronization between
synchronization scheme for F28335. It can be seen that the PWM modules are con-
one fed onto the synchronization input EPWMxSYNCI of the next one. Only the
input synchronization for the first ePWM module is taken from an external pin.
For each ePWMmodule, once apulse from the synchronization input is detected, the
value in the time-base phase register (TBPHS) will be loaded into time-base counter
(TBCTR), where time-base phase register (TBPHS) will be loaded into time-base
register (TBPHS) is used to store the time-base counter (TBCTR) phase value of the
ePWM module with respect to the time-base of its synchronization input signal. As
we know that the inverter output are three phase voltages which are leading or lagging
each other by 120, this is not going to show up in the project i.e. the three PWM sig-
nals have the same phase at any moment. The ePWM module ePWM1, ePWM2 and
ePWM3 are selected for the three-phase PWM generation. Hence the time-base phase
36
Figure 4.6: Internal modules of ePWM and their connections [3]
register (TBPHS) for the ePWM modules are assigned the value of 0. It means that
there is no phase shift between the output signal ePWM1A, ePWM2A and ePWM3A.
bit (SYNCOSEL) in the time base control register (TBCTL) is supposed to be con-
EPWM1SYNCO pulse each time its time-base counter (TBCTR) equals zero, while
37
Figure 4.7: Time base counter synchronization scheme for F28335
nal is set equal to its synchronization input EPWM2SYNCi signal to drive it into
ePWM3 unit. Except ePWM1, the other modules ePWM2 and ePWM3 have to load
the time-base counter (TBCTR) with the time-base phase register (TBPHS) when a
achieved by the comparison between a counter (TBCTR) value (carrier wave) and a
set-point (reference wave) which is stored in counter-compare register. Fig. 4.6 shows
the way to generate a PWM waveform. In the PWM waveform generation process, the
counter-compare submodule (CC) takes the part of event generation, while the action
qualifier takes action on other things. In counter-compare submodule, there are two
compare B register (CMPB) to store the values which are used to compare values
(TBCTR) is treated as the input while the generated event TBCTR = CMPA or
TBCTR = CMPB is the expected output. The Fig. 4.6 show the way it is done
38
in this project. Whenever the carrier wave hits the counter-compare (CMPA) value
on the rise, the ePWMxA is set to off and whenever the carrier ePWMxA hits the
the previous submodules are available. The previous submodules that have to gener-
ate events are time-base submodule and counter-compare submodule and hence these
two submodule events are the inputs to the action qualifier submodule. The first one
generates event TBCTR = 0 and TBCTR = TBPRD while the second one produces
TBCTR = CMPA and TBCTR = CMPB. Having time-base counter (TBCTR) state
incrementing or decrementing, the four events are expanded into eight event combi-
nations. When a specified event takes place out of the eight events, there are four
nothing, which can determine the shape of the PWM waveform. The action qualifier
39
output control register (AQCTLA) is used to define the actions that should be taken
if specified events occur. The conditions that are selected in this project to be con-
figured such that when TBCTR = CMPA and TBCTR is decrementing, ePWMxA
is set to high; while TBCTR is incrementing, ePWMxA is cleared low. The arrows
We also require a complimentary signal which is required to feed both the upper and
lower IGBTs in the same leg of the inverter. The dead band submodule can be used
to take the ePWMxA as the signal source and then to produce the two mutually
band submodule is shown in Fig. 4.7. The function of dead band submodule depends
on the six switches present in it. Different combinations of the switches generate
different modes for signal pairs. Since there are six switches, many combinations can
be produced. But in this project, we dont use many of them. The reason behind
inserting the dead band into the ideal PWM waveform is to avoid the two IGBTs
on the same bridge leg of the inverter turned on simultaneously. Therefore operating
mode Active High Complementary (AHC) is selected as the desired one for a pair of
power switches in one phase of a 3-phase motor control system, which can be achieved
by setting the states of the switches in Fig. 4.7, which can be configured in dead band
control register (DBCTL). In Fig. 4.7, a rising edges delay block and a falling edges
delay block are used to insert a rising edge delay or a falling edge delay into the
original PWM output. With the switch S4 and S5 set to 0, ePWMxA is chosen as the
input source for both output A and B. By setting switch S2 to 0 and S1 to 1, a rising
edge delay is inserted into the original ePWMxA signal; by setting switch S3 and S0
to 1, ePWMxA signal is reversed with a falling edge delay added, which is output as
ePWMxB signal. The generated PWM signal in Active High Complimentary mode is
40
Figure 4.9: Block diagram of ePWM dead band submodule
shown in Fig. 4.8. It can be observed that there is an extremely short period of each
PWM period, when both outputs of the ePWMx module are cleared, which avoids
the mutually complimentary PWM signals are set high at the same time.
output should trigger the ADC start of conversion. But sometimes in a sampling
period, the ADC start of conversion is executed first, then the sampled data is used
to calculate the PWM output. This shouldnt happen which might return in wrong
results. Therefore ADC and PWM signals should be synchronized to function in the
same pace. The event trigger submodule in ePWM is to issue interrupt request or
ADC conversion after receiving event inputs. In order to avoid aliasing from current
ripple, the carrier wave peaks are always chosen as the sampling time instants. Both
TBCTR = 0 and TBCTR = TBPRD can meet this requirement and sampling. In
this project, TBCTR = 0 is defined as the event that triggers ADC start of conversion
41
Figure 4.10: Waveform of PWM with dead band inserted
TBCTR = TBPRD.
entered in the counter-compare register corresponds to the duty cycle of the PWM
each PWM period to generate the PWM wave with varying duty cycle. The relation
between the values set in CMPA register and PWM duty cycle can be written as:
CM P A = T BP RD × (1 − D) (4.7)
All the submodule roles are introduced in previous sections. The specific output value
of the inverter should be equal to the digital signal given by the DSP, at any point
of time. For instance, let us take an extreme situation case, phase A. The output
voltage for phase A is controlled by switch S1 and S4 and the PWM signals imposed
on S1 and S4 are mutually complimentary. The Vdc is defined as the DC link voltage
42
for the inverter. During a sampling period of the PWM, the switch S1 is turned on
and switch S4 is turned off for the same period. It also can be said in this way that,
the duty cycle of the PWM wave fed to switch S1 is 100 percent, the output voltage
of phase A should be +Vd c/2; on the other side, if the switch stays off and switch S4
is turned on for the whole cycle, the duty cycle for switch S1 is 0 percent, the output
voltage of phase A turns to be V dc/2. And if both the switches are on for one half
of the cycle period, the average voltage of phase A is supposed to be 0. From the
principle of PWM, as the carrier wave of the modulation is triangular wave, from the
basic geometrical knowledge it can be found that the relation between the output
phase voltage from the inverter and the corresponding PWM duty cycle is linear. In
general, if the PWM duty cycle stands at any one point in the range from 0 to 1, the
+Vdc −Vdc
Va = ( ) × Da + ( ) × (1 − Da ) (4.8)
2 2
where Da is denoted as the duty cycle for the upper IGBT of the bridge leg connected
to phase A. From the above relation, the duty cycle can be written as
Va + V2dc
Da = (4.9)
Vdc
The complimentary PWM waveform ePWMxB for the lower IGBT on the bridge leg
can be generated by reversing ePWMxA in the dead band submodule. Hence only one
counter-compare register (CMPA) is required for the generation of one pair of PWM
outputs on the same bridge leg. From the above relations, the value set in CMPA
can be easily calculated. This process applies to other two phases. As a result, the
Va
CM P Aa = T BP RDa (0.5 − ) (4.10)
Vdc
Vb
CM P Ab = T BP RDb (0.5 − ) (4.11)
Vdc
43
Vc
CM P Ac = T BP RDc (0.5 − ) (4.12)
Vdc
The subscript implies the phase that the register values belong to.
used to process the digital signal form the encoder built on top of the motor. There
are four different modes in which the quadrature module is able to run. They are
quadrature mode, direct count mode, up count and down count mode. In quadrature
mode, the eQEP module receives two square wave signals from the encoder. These
two square wave signals (A and B) have 90 phase shift with respect to each other,
which can be used to determine the rotation direction. If square wave A is leading
with respect to square wave B, then the rotation is said to be in clockwise direction
and on the other side, if the square B is leading with respect to square wave A,
one square wave signal and one direction signal are sent to the eQEP module. The
counter in the module will increase or decrease depending on the direction. For both
modes, an index pulse signal is used to determine the absolute position of the encoder.
The operating mode of the eQEP module is selected by the type of encoder. As the
incremental encoder is used in this project outputs the quadrature signals, the eQEP
of eQEP module is shown in Fig. 4.11 which shows the functionality of the encoder.
Two quadrature waves are sent to the QA pin and QB pin of the decoder block
as shown in the Fig. 4.11. Every falling or rising edge of QA and QB will generate
a clock signal (QCLK), which is passed to the position counter (QPOSCNT) from
the decoder. The QPOSCNT will increase or decrease by 1 unit on each pulse of
QCLK, depending on the direction signal (QDIR). If the rotation is clockwise, the
QPOSCNT will increase by 1 unit for every pulse. If the rotation is anti-clockwise,
the QPOSCNT will decrease by 1 unit for every pulse. The following Table 4.2 show
44
Figure 4.11: Block diagram of eQEP module [4]
the details of the values of QDIR and QPOSCNT. Fig. 4.12 shows the example
waveform of the eQEP, which has the quadrature QA and QB pins, index pulses.
Every time the position counter (QPOSCNT) is reset by the index signal. When it
meets the index signal for the first time, the eQEP module will remember the present
edge and the rotating direction in the first index marker register.
For instance, if the first counter reset happens on the falling edge of QB during
the clockwise direction, then all the later results must be aligned with the falling edge
of QB for the clockwise direction and with the rising edge of QB for the anti-clockwise
direction. The position counter can be reset by the overflow or underflow of itself.
For underflow the limiting value is zero. For the overflow, the upper limiting value
is QPOSMAX, which is the value stored in the QPOSMAX register. This value is
set in the eQEP module in the project. If you do not set the underflow or overflow,
the counter is automatically reset to 0 during the clockwise rotation and reset to
QPOSMAX during the anti-clockwise rotation. If the period of the vector control
loop is set to t, then the rotating speed of the encoder can be calculated as
1s
Speed = × 60rpm (4.13)
t
45
Table 4.2: Encoder Truth table
Edge Edge
QB↑ 1 increment
QB↓ 1 increment
QA↑ 1 increment
QA↓ 1 increment
This condition applies if the encoder rotates one revolution during one control loop
period.
is due to the presence of sensors or the ADC conditioning circuit. These offset of either
the currents or the speed should be measured when the machine is in standstill mode
with all the other modules or devices switched on. The measured offset current from
the three phases should be subtracted from the ADC results in the code to compensate
for the current offset. In order to get the samples of current offset, the DSP is allowed
to settle for some time, allow DSP to run in steady state and then the offset can be
sent to the oscilloscope or can be measured by taking many sample per second and
taking average of them. The speed offset can be done using the same way as the
current offset.
plement the simulink code on to the DSP. Fig 4.13 shows the setup that has been
46
Figure 4.12: An example waveform of the eQEP (anti-clockwise rotation)
used for the project. The idea of the setup is to have all the equipment namely power
supplies, inverter, DSP board, transformers and the motor on the same platform.
The setup has access to limited input ports and output ports which are used in this
project. There are two switching power supplies in the setup out of which, one acts
as the input source for inverter (48V DC) and the other acts as input source for DSK
board (24V DC). Since the input voltage for the inverter is 48V DC , the maximum
47
voltage that can be obtained from the inverter is 24V (Vdc/2). The output of the
inverter is then boosted up to 240V using three boost tansformers. The transformer
connections are delta-delta connected. The PWM signals generated digitally and the
analog values in the DSK are sent to the inverter using bus cables as shown in the fig.
4.13. The DSP is emulated using USB JTAG emulator through which, the program
in the computer is sent to the DSP. The DAC pins at the bottom of the figure are
used to receive output signals such as voltages, currents and speed. A serial Commu-
nications interface is setup and connected to computer which enables the serial (one
bit at a time) exchange of data between the DSP and the computer.
After switching the power supply on, the DSP has to be initialized. The already
to each function unit. The initialization functions only provide the most basic sup-
ports for running the system, for example to initialize the system clock or to enable
some modules.
4.3.2 Configuration
The modules present in the design can run in different modes depending on the
application. But for this project, to run our application, the module units are con-
figured to suitable operating mode as shown in below sections. Each module is taken
individually and both the C code and the Simulink code are presented to illustrate
the difference in configuration setting. The tables 4.3, 4.4 and 4.5 shows the configu-
48
Table 4.3: Configuration of ADC
No. of Conversions 8
(a) (b)
49
(a) (b)
Phase shift 0
50
Figure 4.16: Simulink configuration for ePWM
51
Figure 4.17: Simulink configuration for ePWM
Processors. It consists of all the tools that are used to develop and then debug embed-
ded applications. Code Composer Studio also contains optimizing C/C++ compiler,
source code editor, project build environment, debugger, profiler and many other fea-
tures. The IDE provides a single user interface taking you through each step of the
application development flow. Getting familiar with all the tools and features of the
software makes it easier. Code Composer Studio combines advantages of the Eclipse
52
software framework with advanced embedded debug capabilities from TI resulting in
The figures below and the theory corresponding to the figures helps a new user to
configure CCS v5.5 at any point of time. The early process of configuring CCS v5.5
is to generate a makefile, which is used to automate building and then deploying the
dow, where you can see a command enter signal as >>. If you see that symbol, enter
the command xmakefilesetup in the Matlab command window. The command pops
If the dialog box does not show up in the same way as the above figure, then the
53
things that should be taken care are the clone configurations. The instructions for
achieving this configuration are: Firstly, clear the check box for display operational
configurations only and click on the N ew configurations, which should pop a display
box showing the names of the configurations. Select the appropriate configurations
for the application and then it creates a configuration that can be applied for the
project.
order to generate an output file, which is appropriate and suitable for the DSP that is
being used in this project. Coming to the solver pane of the configuration parameters,
the values should be selected for the start and stop times of the code and also the solver
type should be selected. The parameters that have been used for this project are the
fixed step solver and discrete solver. Some of the parameters are set by default and are
to the hardware section, the hardware that is being implemented in this project is
the Texas Instruments Product and the device is a C2000 family type. Under the
Code generation pane, it should be noticed that the system target file is selected as
idelink − grt.tlc. By doing it that way, the system links the IDE environment to the
target hardware. Also a new pane called coder target pane is available, where all the
parameters about the actual hardware are updated. Later on under the coder target
pane, the build format is set to makefile, since the output format we selected earlier
The action is set to Build and Execute, which enables the system to build an exe-
cutable file. This process almost sets the configuration of CCS v5.5 on to the system
and you are ready to go. Before you start building the code on CCS v5.5, just make
sure to have everything correct, in case you had something not fixed. The first time
you use embedded coder with Code Composer Studio, you should check that the CCS
54
is installed and configured properly and also has at least one board configured. To
do that, enter the command ccsboardinf o in the Matlab command prompt window.
Matlab, then returns all the boards that are configured and recognized by the CCA
as shown as below.
Also, if necessary check all the third party tools and environment variables that
are set in the configuration using the command checkEnvsetup(ccs, f 28335, check).
55
4.4 Incremental Build Technology
Even though the programming is done by evaluating each block at a time, like
modular programming, sometimes it is difficult to debug if all the modules are lumped
together at a time. Therefore, the program structure is built level by level. Every
time before building a new level, the old level should be working correctly.
board, which might be issue in many cases. In this section, brief discussion about some
of the damages that could be done to the DSP and the troubleshooting techniques to
For the first case, let us take an example of having excess current flowing in
the circuits of DSK, which might result in the damage od some of the parts in the
DSK. If you experience bad smell from the DSK board or an unpleasant smell from
the board, immediately turn the system off, as there is some problem in the code.
Coming to troubleshooting the DSP, firstly, check the power circuit underneath the
DSK board and you can see the circuit leading from the 24V power supply to the
15V power supply of the PWM signal generation. It can be clearly noticed that the
power supply of the PWM is damaged and has to be replaced. The damaged PWM
power supply is then de soldered and then it should be replaced with a new power
For the second case, let us take an example of overwriting the DSP default vari-
ables and clearing everything from the memory, which might result in the damage to
the main chip in the DSK. The symptoms to this problem are that you may not be
able to receive correct waveforms from ADC and PWM. This problem can only be
eliminated by replacing the chip on the DSK with a new one and that should work
properly.
56
5. Testing and Evaluation
In this chapter, the testing results are shown. As mentioned before, the control
system is programmed in three levels, namely the open loop system, system with cur-
rent regulator and the system with speed regulator, and its performance is evaluated
troller and observing the corresponding motor speed. The testing data are listed in
Frequency set(Hz) 10 15 20 25 30 35 40
It can be seen from the table 5.1 that, the induction motor runs slightly slower
than the synchronous speed. With increase in the frequency, the slip is also increasing.
This might be due to the reason that the friction torque becomes larger with increasing
access the DAC memory, while the processor is still running. In order to capture the
dynamic response of d and q currents, two memory locations are allocated and can be
directly accesses using the oscilloscope. Once the step change in current reference is
applied, in each control loop, the value of d and q current is stored in the memory until
the memory if full. In the code, if these variables are converted directly to integer, the
57
resolution will be greatly reduced. To guarantee enough resolution, before converting
a variable, the variable is multiplied by 4095 or 2047, depending on how large its
(a) (b)
Figure 5.1: Step response of the d and q currents.Fig(a) is the step response of the
d current with a reference of 80mA, and fig(b) is the step response of the q current
(a) (b)
Figure 5.2: Response in q current due to a step in i current. Fig. (a) shows q
current with respect to step in d current and Fig. (b) shows q current with respect
and iq are same and matches the design specifications. Though there is noise on
both the curves, it can be noticed that the currents arrive at their reference values
without steady-state error. The only problem is that we have a overshoot in the
iq waveform. Since the desired closed-loop system is a first-order system and anti-
windup has been added, there should not be any large overshoot. But other than
20rad/sec. In order to eliminate the non-linearity and two much fluctuation, a much
smaller bandwidth αω for the speed control loop and a smaller reference speed are
Figure 5.3: Speed step response at 300rpm and very small bandwidth
59
5.3.2 Analysis on Results
Given the speed control loop bandwidth αω , the rise time of the speed response
acceleration which causes an unnoticeable overshoot. But the difference between the
simulation results and the experimental results might be due to inaccurate speed
sensing, incorrect motor parameters like B and J, the motor coefficients. The other
factor might be due to inaccurate flux estimation. The variation in the machine
parameters will greatly affect the flux estimation. The error between the estimated
and the actual flux will lead to a wrong calculation of the q current reference, which
60
6. Simulink or C: A comparitive study
This chapter discusses the main research contribution to this project. In the past
few years, C language has been a primary language for the interface between the real
time models. But, in this project, unlike various other projects which uses C as their
an environment for simulation and model-based design for dynamic and embedded
systems.
6.1 Introduction to C
Embedded Processors can be programmed using various languages. However, the
following figure Fig. 6.1 shows that C is used by more than a four-to-one margin over
is that it is a medium level language, in contrast to other high languages like JAVA or
low languages like Assembly. C, with its medium level of complexity is understandable
61
to humans, executes at a reasonably fast speed, and usually allows programmers to
exercise enough control over the inner working of the embedded processor. This
balance between intelligibility and fundamental control make C language the prime
an extremely fast execution speed is needed for a specific instruction, a few lines of
that program into an executable file. C in the form that a programmer writes is called
source code, and must go through the build process to generate functional code. This
source code must first be compiled, once compiled the resulting object code is linked
using a linker program. A linker attempts to find any libraries of code that the object
might need to perform its function (e.g. other object code compiled from other source
code); links these bits of code together; and creates an .exe executable file that can
be run.
6.1.2 Drawbacks of C
As discussed above, it is understood that the C language is the widely used
programming language globally because of its executing speed and efficiency. In con-
trast to the advantages produced by the old standby computing language that many
would call obsolete: ANSI C, there are some drawbacks that could be encountered in
developing a model for a particular design. C and other higher languages have be-
come popular for modelling DSP algorithms because of the more concise expression of
tion. To become implementable, the tradeoff for description languages like C should
become less concise. Sometimes the C becomes so complicated at instances like aug-
because of the conciseness in C, the code can be difficult to follow. I does not suite to
applications which require formatting and data file manipulation. For learning how
to write programs in C, we must first know what alphabets, numbers and symbols are
used, then how constants, variables and keywords are formed, and finally how these
project using C as the main language, this section will explain the alternative language
that should be replaced in place of traditional language C. The main reason that a
different approach is used in this project is to reduce the overall time that takes for the
efficiently.
control, in this project, a new approach of using Simulink as the interface between
the software and the hardware. Also, this approach enabled us to create a completely
new technology of using Simulink to execute a makef ile to run the hardware, as well
embeddedcoder. This approach proved beneficial for this project as you can generate
both the Simulink and C code at the same time and in a reduced amount of time.
into consideration, that can implemented similarly on the target hardware and then,
both the approaches are compared for the time length of the project. The Fig. 6.2
shows the flow chart diagram representing the various steps involved in both the
approaches. As seen from the figure, both the approaches produce the same result.
63
However, approach1 does not offer flexibility in transiting to a different approach,
which in our case is appraoch2. But, appraoch2 offers a much flexibility in doing the
same thing.
Figure 6.2: Illustration of two different approaches that can be used in the project
of block libraries that let you design, simulate, implement, and test a variety of
64
time-varying systems, including communications, controls, signal processing, video
processing and image processing. Simulink offers the quickest way of developing your
integrated solvers. But, for C, you have write to write the code to create a solver.
Simulink provides an efficient design and simulation framework for creating high-level
algorithm models and limited capabilities that directly assist in implementation. More
specifically, it allows for defining sample rates and fixed-point data types, a discrete-
time modelling engine, and a rich set of mathematical operations and analysis tools.
and sample rates through the algorithm data path. This process saves significant
65
7. Conclusions
The main purpose and objective of this project are generally achieved. The
evaluation board seems to be working well for this project. Considering the interface
board part, the digital signal interfaces, such as PWM and incremental encoder, work
satisfactorily. But, if you observe the current signals from ADC, there is some noise
added to the measured signals. For the vector control design, the control system
on the DSP manages to control the d,q currents and speed accurately. One of the
problems that can be observed from the experimental results is the overshoot in q
current during the current control loop test. It was assumed that the problem might
In the final section of this project, a comparison is done between the old con-
ventional approach and new approach used in this project in designing the vector
control algorithm. It can be concluded that, the approach which uses Simulink as the
interfacing language seems to have higher efficiency and flexibility in terms of time
when compared to the approach which uses C as the interfacing language for those
ADC noise, the ADC conditioning circuit needs to be improved. New control strate-
gies could also be considered for control design in order to make system less sensitive
to parameter variation and reduce harmonic distortion. Finally, from many research
66
REFERENCES
[7] K. Aissa and K. D. Eddine. Vector control using series iron loss model of in-
duction, motors and power loss minimization. World Academy of Science, En-
gineering and Technology, 2009.
[10] Seung-Ki Sul. Control of Electric Machine Drive Systems. Wiley-IEEE Press,
2011.
[12] Frede Blaabjerg and Ion Boldea Ioan Serban, Dorin Iles-Klumpner. Sensorless
Control of Wound Rotor Induction Generator for wind power applications: the
experimental test platform. IEEE.
67
[16] Texas Instruments. Code Composer Studio Integrated Development Environ-
ment. www.ti.com/tool/ccstudio.
[21] Texas Instruments. F2833x analogue digital converter. Texas Instruments, Tech.
Rep.
[22] Texas Instruments. TMS320x280x, 2801x, 2804x enhanced pulse width modula-
tor(epwm) module. Texas Instruments, Tech. Rep., July 2009.
68
Appendix A. Simulations and Waveforms
A.1 Simulations
69
Figure A.3: Simulink model for Current control
70
Figure A.4: Simulink model for Speed control
71
A.2 Waveforms
(a) (b)
Figure A.5: (a) shows Stator voltages in abc reference frame and (b) shows Stator
72
(a) (b)
Figure A.7: (a) shows Stator currents in abc reference frame and (b) shows Stator
73
Figure A.9: Theta varying from −Π to +Π
74