dsp for space vector

Upload: sivananda11

Post on 13-Jan-2016

49 views

Category:

Documents


5 download

DESCRIPTION

Dsp for Space Vector

TRANSCRIPT

  • 1

    PROGRAMMING IN DSP FOR SPACE VECTOR GENERATION USING

    F2812 EZ-DSP

    Project report submitted in partial fulfillment of the requirements

    For the award of the degree of

    BACHELOR OF TECHNOLOGY

    IN

    ELECTRICAL AND ELECTRONICS ENGINEERING

    By

    B.CHANAKYA REDDY (08241A0262)

    Y.KIREETI (08241A0271)

    K.SAINADH (08241A0295)

    Under the guidance of

    S. SHIVA KUMAR

    Assistant Professor

    Department of Electrical and Electronics Engineering

    GOKARAJU RANGARAJU INSTITUTE OF ENGINEERING & TECHNOLOGY,

    BACHUPALLY, HYDERABAD-72

  • 2

    2012

    GOKARAJU RANGARAJU INSTITUTE OF ENGINEERING AND TECHNOLOGY

    Hyderabad, Andhra Pradesh.

    DEPARTMENT OF ELECTRICAL & ELECTRONICS ENGINEERING

    C E R T I F I C A T E

    This is to certify that the project report entitled PROGRAMMING IN DSP FOR SPACE

    VECTOR GENERATION USING F2812 EZ-DSP that is being submitted by B.CHANAKYA REDDY, Y.KIREETI ,K.SAINADH in partial fulfillment for the award of the Degree of

    Bachelor of Technology in Electrical and Electronics Engineering to the Jawaharlal Nehru Technological University is a record of bonafide work carried out by him under my guidance and

    supervision. The results embodied in this project report have not been submitted to any other

    University or Institute for the award of any graduation degree.

    Mr.P.M.SHARMA Mr. S. SHIVA KUMAR EXTERNAL

    HOD,EEE Assistant Professor.

    GRIET, Hyderabad GRIET, Hyderabad

  • 3

    (Internal Guide)

    Acknowledgement

    This is to place on record my appreciation and deep gratitude to the persons without whose

    support this project would never seen the light of day.

    I have immense pleasure in expressing my thanks and deep sense of gratitude to my guide

    MR.S.SHIVA KUMAR , Assistant Professor, Department of Electrical

    Engineering,G.R.I.E.T for his guidance throughout this project.

    I also express my sincere thanks to Mr.P.M.SHARMA, Head of the Department, and

    Mr.M.CHAKRAVARTHY Associate Proffessor G.R.I.E.T for extending his help.

    I express my gratitude Dr. S.N.SAXENA, Project Supervisor G.R.I.E.T for his valuable

    recommendations and for accepting this project report.

    Finally I express my sincere gratitude to all the members of faculty and my friends who

    contributed their valuable advice and helped to complete the project successfully.

    B.CHANAKYA REDDY

    Y.KIREETI

    K.SAINADH

  • 4

    ABSTRACT

    Scalar control of Induction Motor is simple to implement, but the inherent coupling effect ( i.e

    both torque and flux are functions of voltage or current and frequency)gives sluggish response

    and system is easily prone to instability because of a high-order system effect. These problems

    can be solved by vector or field-oriented control. In this vector control, Induction motor can be

    controlled like separately excited DC Motor. DC machine-like performance can also be extended

    to an induction motor if the machine control is considered in synchronously rotating reference

    frame, where the sinusoidal variables appear ac DC quantities in steady state. Because of DC

    machine-like performance, vector control is also known as decoupling, orthogonal, or trans-

    vector control. Vector control and corresponding signal processing, particularly for modern

    sensor less vector control, are complex and the use of powerful micro-processor or DSP is

    mandatory. We use PWM inverter to drive the Induction Motor. Outputs from DSP are PWM

    signals and used as gate pulses of inverter. We can say it also a pulse width modulation speed

    drive. Pulse Width Modulation variable speed drives are increasingly applied in many new

    industrial applications that require superior performance. Recently, developments in power

    electronics and semiconductor technology have lead improvements in power electronic systems.

    Hence, different circuit configurations namely multi level inverters have become popular and

    considerable interest by researcher are given on them. Variable voltage and frequency supply to

    a.c drives is invariably obtained from a three-phase voltage source inverter. A number of Pulse

    width modulation (PWM) schemes are used to obtain variable voltage and frequency supply. The

    most widely used PWM schemes for three-phase voltage source inverters are carrier-based

    sinusoidal PWM and space vector PWM (SVPWM).There is an increasing trend of using space

    vector PWM(SVPWM) because of their easier digital realization and better dc bus utilization.

    This project focuses on step by step development SVPWM implemented on an Induction motor.

    The model of a three-phase a voltage source inverter is discussed based on space vector theory.

  • 5

    ABBREVIATIONS

    1.PWM : Pulse width modulation

    2.DSP: Digital signal processor

    3.CCS: Code composer studio

    4.SVPWM: Space vector PWM

  • 6

    INDEX

    1. Introduction

    1.1 introduction

    1.2 scalar control

    1.2.1 v/f control scheme

    1.2.1.1 advantages and disadvantages

    1.3 Vector control

    1.3.1 FOC control scheme

    1.3.1.1 park transform.

    1.3.1.2 Clarke transform

    1.3.1.3 space vector generation

    1.4 conclusion

    2. d-q model of induction motor

    2.1 axes transform

    2.2 conclusion

    3. Principles of vector control

    3.1 DC drive analogy

    3.2 equivalent circuit and phaser diagram

    3.3 basic principles of vector control

    3.4 conclusion

    4. Park-transform

    5. Clarke-transform

    6. Space vector generation

  • 7

    6.1 description

    6.2.1 object definition

    6.2.2 special constants and data types

    6.2.3 methods

    6.3 technical details

    6.4 conclusion

    7. Space vector generation

    7.1 description

    7.2 C-interface

    7.3 Inputs and outputs of I-park transform

    7.4 special constants and data types

    7.5 methods and usage

    7.6 C-code

    7.7 mathematical principles

    7.8 conclusion

    8.Pulse width modulation

    8.1 introduction

    8.2 description

    8.3 C-Interface

    8.4 special constants and data types

    8.5 methods and usage

    8.6 technical back-ground

    8.7 conclusion

    9. Hardware implementation

    9.1 Hardware laboratory set up

  • 8

    9.2 circuit description

    9.3 operation of project

    9.4 hardware and output waveforms

    REFERENCES

  • 9

    1. INTRODUCTION

    1.1 Introduction

    The control and estimation of Induction Motor drives constitute a vast subject, and the

    technology has further advanced in recent years. Induction motor drives with cage-type machines

    have been the workhorses in industry for variable-speed applications in a wide power range that

    covers from fractional horse-power to multi-mega watts. These applications includes pumps and

    fans ,paper and textile mills subway and locomotive propulsions, electric hybrid vehicles,

    machine tools robotics, wind generations systems, etc. In addition to process control ,the energy

    saving aspect of variable-frequency drives is getting a lot of attention nowadays.

    The control and estimations of AC drives in general are considerably more complex than those

    of dc drives, and this complexity increase substantially if high performances are demanded. The

    main reasons for this complexity are the need of variable-frequency, harmonically optimum

    converter power supplies, the complex dynamics of AC machines, machine-parameter variations,

    and the difficulties of processing feedback signals in the presence of harmonics.

    While considering drive applications, we need to address following questions:

    one, two or four quadrant drive ?

    Torque, speed, or position control in the primary or outer loop ?

    Single or multi-motor drive ?

    Range of speed control? does it include zero speed and field weakening regions?

    Accuracy and response time ?

    Robustness with load torque and parameter variations ?

    Control with speed sensor or sensor less control?

    type of front end converter?

  • 10

    Efficiency, cost, reliability, and maintainability considerations?

    Line power supply, harmonics, and power factor considerations?

    There are different control techniques used to drive an Induction Motor. Scalar control, vector or

    field-orientation control, direct torque and flux control, and adaptive control are used in majority

    industrial and commercial drives.

    1.2 Scalar Control

    Scalar control, as the name indicates, is due to magnitude variation of the control of the control

    variables only, and disregards the coupling effect in the machine. For example, voltage of a

    machine can be controlled to control the flux, and frequency or slip can be controlled to control

    the torque. However , flux and torque are also functions of frequency and voltage, respectively.

    Scalar control is in contrast to vector control , where both the magnitude and phase alignments of

    vector variables are controlled. Scalar-controlled drives give somewhat inferior performance, but

    they are easy to implement. Scalar controlled drives have been widely used in industry.

    However, their importance is diminished recently because of superior performance of vector-

    controlled drives, which is demanded in many applications. V/F control method is one of the

    scalar controlling methods.

    1.2.1 V/F control method

    The V/Hz regulation scheme is the simplest one that can be applied for an asynchronous motor.

    The goal is to work in an area where the rotor flux is constant (Volts proportional to speed). In

    practical solutions, the speed sensor is optional as the control is tuned to follow a predefined

    speed-profile versus load- table, assuming the load characteristics are known in advance.

    Obviously, this type of control bases itself on the steady electrical characteristic of the machine

    and assumes that we are able to work with a constant flux on the complete speed range the

    application targets. This is why this type of control does not deliver a good dynamic performance

    and a good transient response time; the V/Hz profile is fixed and does not take into account

    conditions other than those seen in a steady state. The second point is the problem at startup AC

    induction motors, which cannot deliver high torques at zero speed; in this case, the system

  • 11

    cannot maintain a fixed position. In practice for low speed, we need to increase the delivered

    voltage to the stator compared to the theoretical V/Hz law.

    1.2.1.1 Advantages and disadvantages

    + Simple to implement: All you need is three sine waves feeding the motor

    + Position information not required (optional).

    Doesnt deliver good dynamic performance.

    Torque delivery not optimized for all speed

    Fig 1.1

    V/F control scheme of Induction motor.

    1.3 VECTOR CONTROL

    Scalar control of Induction Motor is simple to implement, but the inherent coupling effect ( i.e

    both torque and flux are functions of voltage or current and frequency)gives sluggish response

    and system is easily prone to instability because of a high-order system effect. These problems

    can be solved by vector or field-oriented control. In this vector control, Induction motor can be

  • 12

    controlled like separately excited DC Motor. DC machine-like performance can also be extended

    to an induction motor if the machine control is considered in synchronously rotating reference

    frame, where the sinusoidal variables appear ac DC quantities in steady state. Because of DC

    machine-like performance, vector control is also known as decoupling, orthogonal, or trans-

    vector control. Vector control and corresponding signal processing, particularly for modern

    sensor less vector control, are complex and the use of powerful micro-processor or DSP is

    mandatory. Field Oriented Control (FOC) or Vector Control, is a control strategy for 3-phases

    induction motors where the torque producing and magnetizing component of the stator flux are

    separately controlled. The approach consists in imitating DC motors operation. FOC will be

    possible with system information: currents, voltages, flux and speed.

    Instead of using a pure sine wave shaped modulation of the PWM stage, in recent years the space

    vector theory has demonstrated some improvements for both the output crest

    voltage and the harmonic copper loss. The maximum output voltage based on the space

    vector theory is 1.155 times larger than the conventional sinusoidal modulation. It makes it

    possible to feed the motor with a higher voltage than the simpler sub-oscillation modulation

    method. This modulator enables higher torque at high speeds, and a higher efficiency. Torque

    distortion is also reduced. The space vector PWM technique implemented into the

    existing TI DMC library reduces the number of transistor commutations. It therefore

    improves EMI behavior. A typical characteristic of FOC - PWM command strategy is that the

    envelope of the generated signal is carrying the first and the third harmonics. We can interpret

    this as a consequence of the special PWM sequence applied to the power inverters.

    Literature also mentions the third harmonic injection to boost out the performance we get out

    of the DC bus capacitor. This third- harmonic exists in the phase to neutral voltage but

    disappears in the phase-to-phase voltage.

    1.3.1 FOC control scheme

    The overall system for implementation of the 3-phase PMSM control is depicted below. The

    Induction Motor is driven by the conventional voltage-source inverter. The C28x is

    generating six pulse width modulation (PWM) signals by means of space vector PWM technique

    for six power- switching devices in the inverter. Two input currents of the Induction motor (ia

    and ib ) are measured from the inverter and they are sent to the C28x via two analog-to-digital

    converters (ADCs). Theoretically, the field oriented control for the Induction Motor drive

    allows the motor torque be controlled independently with the flux-like DC motor operation. In

    other words, the torque and flux are decoupled from each other. The rotor position is

    required for variable transformation from stationary reference frame to synchronously

    rotating reference frame. As a result of this transformation, the so called Park

    transformation, the q-axis current will be controlling the torque, while the d-axis current

    will be controlling flux. Here d means direct and q means Quadrature. Therefore, an

    important key module of this system is the information of rotor position from QEP encoder. Note

  • 13

    that the same control scheme with an additional field weakening controller can be used to

    control3-phase asynchronous AC induction motors. We use some mathematical operations

    Fig 1.2

    Vector control scheme for AC motor

    In FOC scheme. These are park transformation, Clarke transformation, inverse park

    transformation, space vector generation, etc.

    1.3.1.1 Park transform

    The PARK transform is not something new. This theory has been around for 75 years. As we

    will see, this technique requires a large amount of mathematical calculations involving in

    particular matrix multiplications. Thanks to new control processor technologies, it becomes now

    possible to use this real-time control technique. We discussed about these is later chapter.

    1.3.1.2 Clarke transform

    The normalized PARK can be seen as the result of the combination of the CLARKE transform

    combined with a rotation. Literature sometimes refers to PARK in this way: this is the case for

    the TI Digital Motor Control library. This gives an intermediate step that helps to build the

    regulation scheme. We discussed about these in later chapters.

  • 14

    1.3.1.3 Space vector generation

    Principle of Space Vector PWM : Treats the sinusoidal voltage as a constant amplitude vector

    rotating at constant frequency. This PWM technique approximates the reference voltage Vref by

    a combination of the eight switching patterns (V 0 to V7 ) Coordinate Transformation ( abc

    reference frame to the stationary d-q frame) . A three-phase voltage vector is transformed into a

    vector in the stationary d-q frame which represents the spatial vector sum of the three-phase

    voltage . The vectors (V1 to V6 ) divide the plane into six sectors (each sector: 60 degrees) .Vref

    is generated by two adjacent non-zero vectors and two zero vectors .

    1.4 Conclusion

    Vector control scheme is widely used in many applications over than scalar control scheme,

    because of its good dynamic performance in controlling, fast response, especially for large rated

    applications as discussed earlier.

  • 15

    2. d-q model of Induction Motor

    The per phase equivalent circuit of a induction machine is only valid in steady state condition. In

    an adjustable speed drive, the machine normally constitutes an element within a feedback loop,

    and therefore its transient behavior has taken into consideration. Besides, high performance drive

    control, such as vector control, is based on dynamic d-q model of the machine. Therefore to

    understand vector control principles, a good understanding of d-q model is mandatory. The

    dynamic performance of an Induction motor is somewhat complex because the three-phase rotor

    windings move with respect to stator windings. The machine model can be represented by

    differential equations with time varying mutual inductances, but such model tends to be very

    complex. The three phase machine can be represented by an equivalent two-phase machine as

    shown fig 2.1, where ds-qs correspond to stator direct and quadrature axes, dr-qr correspond to

    rotor direct and quadrature axes.

  • 16

    Fig 2.1

    Equivalent two phase machine of Induction machine

    2.1 Axes transformation

    Consider a symmetrical three-phase Induction machine with stationary as-bs-cs axes at 120 deg

    angle apart. Our goal is to transform the three phase stationary reference frame variables in to

    two phase stationary reference frame(d.s-q.s) variables and then transform these to

    synchronously rotating reference frame(de-qe), vice versa. Assume that d.s-q.s axes are oriented

    at angle, as shown in figure 2.2.

  • 17

    Fig 2.2

    Stationary frame a-b-c to ds-qs axes transform

    The voltages Vds.s and Vqs.s can be resolved into as-bs-cs components and can be represented

    in the matrix form as

    3

    2

    1

    )(

    S

    s

    s

    S

    v

    v

    v

    V

  • 18

    Where Vso is added as the zero sequence component, which may not be present.we have

    considered voltage as variable. The current and flux linkages can be transformed by similar

    equations.

    It is convenient to set =0, so that the Qs axis is alingned with as-axis. Ignoring the zero

    sequence component, the transformation relation can be simplified as

    Vas=Vqs.s

    Vbs=-0.5Vqs.s-0.866Vds.s

    Vcs=-0.5Vqs.s+0.866Vds.s

    And inversely

    Vqs.s=0.66 Vas-0.33Vbs-0.33Vcs

    Vds.s=-0.577Vbs+0.577Vcs

    Fig 2.3 shows the synchronously rotating de-qe axes, which rotate at synchronous speedwith

    respect to the d.s-q.s axes and =Wet. The two-phase d.s-q.s windings are transformed into the

    hypothetical windings mounted on de-qe axes. The voltages on d.s-q.s axes can be converted into

    the de-qe frame as follows

    Vqes= Vqs.sCOS(wet)-Vds.sSIN(wet)

    3

    2

    1

    1

    3

    2

    1

    3

    2

    1

    )( and .)(

    1 )3

    4sin( )

    3

    4cos(

    1 )3

    2sin( )

    3

    2cos(

    1 sin cos

    S

    S

    s

    S

    So

    Sq

    sd

    so

    sq

    sd

    S

    S

    S

    s

    So

    Sq

    sd

    SS

    SS

    SS

    s

    s

    s

    v

    v

    v

    P

    v

    v

    v

    v

    v

    v

    P

    v

    v

    v

    v

    v

    v

    v

    v

    v

  • 19

    Vdes= Vqs.sSIN(wet)+Vds.sCOS(wet)

    Resolving the rotating reference frame parameters into stationary frame, the relations are

    Vqs.s= VqesCOS(wet)+ VdesSIN(wet)

    Vds.s=-VqesSIN(wet)+ Vdes COS(wet)

    Assume that three-phase stator voltages are sinusoidal and balanced, and are given by

    Vas=VmCOS(wt+)

    Vbs=VmCOS(wt-120+)

    Vcs= VmCOS(wt+120+)

    From figure 2.2

    Vqs.s= VmCOS(wt+)

    Vds.s= -VmSIN(wt+)

    By converting stationary variables into rotating frame variables

    Vqes = VmCOS(wt+ COS(wet)+VmSIN(wt+) SIN(wet)

    -Vqes =VmCOS()

    Vdes= -VmCOS(wt+) SIN(wet) -VmSIN(wt+) COS(wet)

    -Vdes=-VmSIN()

    And Vqes =VmCOS()

    Above two equations verify that sinusoidal variables in a stationary frame appear as DC

    quantities in a synchronously rotating reference frame. This is an important concept in vector

    control technique. We can resolve above equations for currents and flux of induction motor.

  • 20

    2.2 Conclusion

    Thus we convert the three phase voltages of induction motor into two dc values in rotating

    reference frame, which used to control the torque and flux separately as dc motor control.

  • 21

    3. Principles of Vector control

    Scalar control of Induction Motor is simple to implement, but the inherent coupling effect ( i.e

    both torque and flux are functions of voltage or current and frequency)gives sluggish response

    and system is easily prone to instability because of a high-order system effect. These problems

    can be solved by vector or field-oriented control. In this vector control, Induction motor can be

    controlled like separately excited DC Motor. DC machine-like performance can also be extended

    to an induction motor if the machine control is considered in synchronously rotating reference

    frame, where the sinusoidal variables appear ac DC quantities in steady state. Because of DC

    machine-like performance, vector control is also known as decoupling, orthogonal, or trans-

    vector control. Vector control and corresponding signal processing, particularly for modern

    sensor less vector control, are complex and the use of powerful micro-processor or DSP is

    mandatory. Field Oriented Control (FOC) or Vector Control, is a control strategy for 3-phases

    induction motors where the torque producing and magnetizing component of the stator flux are

    separately controlled. The approach consists in imitating DC motors operation. FOC will be

    possible with system information: currents, voltages, flux and speed.

    3.1 DC drive analogy

    Ideally, a vector-controlled induction motor drive operations like a separately excited DC motor

    drive ,as mentioned above. In a DC machine, neglecting the armature reaction effect and field

    saturation, the developed torque is given by

    Te=Kt.Ia.If

    Where Ia is armature current, If is field current. The construction of dc machine is such that field

    flux, f produced by field current(If ), which is perpendicular to the armature flux. These space

    vectors, which are stationary in space, are orthogonal or decoupled in nature. This means that

    when torque is controlled by controlling the current Ia , the flux f is not affected and we get the

    fast transient response and high torque/amphere ratio with the rated f. Because of the inherent

    coupling problem, an induction motor cannot generally give response. DC machine-like

    performance can also be extended to an induction motor if the machine control is considered in a

    synchronously rotating reference frame, where the sinusoidal variable appear as dc quantities in

    steady state. The induction motor with the inverter and vector control in the front end is shown

    with two control current inputs, Ids* and Iqs* are shown in the figure 3.1. These currents are the

    direct axis component and quadrature axis component of the stator current, respectively, in a

  • 22

    synchronously rotating reference frame. With vector control, Ids is analogous to field current, Iqs

    is analogous to armature current of a dc machine. Therefore torque can be expressed as

    Te=Kt.r.Iqs

    Te= Kt.Ids.Iqs

    Where r is peak value of the sinusoidal vector . This dc machine-like performance is only

    possible if Ids is oriented in the direction of flux r and Iqs is established perpendicular to it, as

    shown in figure 3.2. This iqs* controlled, it affects the actual iqs* current only, but does not

    affect the actual iqs only, but does nnot affect the flux r. Similarly, when ids* is controlled, it

    controls the flux only and does not affect the iqs component of current. This vector orientation of

    currents is essential under all operating conditions in a vector-controlled drive. Note when

    compared to dc machine space vectors, induction machine space vectors rotate at frequency w, as

    indicated in the figure. In the figure 3.2. In summary, vector control should assure the correct

    orientation and equality of command and actual currents.

    Fig 3.1

    Vector controlled of Induction motor

  • 23

    Fig 3.2

    3.2 Equivalent Circuit and Phasor Diagram

    Figure 3.3 shows the complex form of de-qe equivalent circuits in steady state condition. For

    simplicity, neglecting the rotor leakage inductance Llr , which makes rotor flux the same as the

    air gap flux m. The stator current Is can be expressed as

    Is=(ids^2+iqs^2)^0.5

    Where ids is magnetizing component of stator current flowing through the inductance Lm and ,

    iqs is torque component of stator current flowing in the rotor circuit. The figure 3.4 shows the d-

    q model circuit of induction motor. The in-phase or torque component of current iqs contributes

    active power across the air gap, whereas the reactive or flux component of current ids contributes

    only reactive power. An increase of iqs will raise the torque and maintain the r constant,

    increase or weakening of flux will remain iqs as constant. These operation is also valid for

    transient conditions. After understanding the vector orientation principle, the next question is

    how to control the ids and iqs components of stator current Is independently with the desired

    orientation. Instead of considering a Cartesian form (ids and iqs) of control, it is also possible to

    consider control in a polar form (IS and ) .

  • 24

    Figure 3.3

    Steady-state phasors

    figure 3.4

    Complex (qds) equivalent circuit in steady state of IM

  • 25

    3.3 Basic principles Vector control

    The fundamentals of vector control implementation can be explained with the help of

    figure 3.5, where the machine model is represented in a synchronously rotating reference

    frame. The inverter is omitted from the figure, assuming that it has unity current gain,

    that is, it generates currents ia,ib,ic as dictated by the corresponding command currents

    ia*,ib*,ic* from controller. A machine model with internal conversions is shown on right.

    The machine terminal phase currents ia, ib, ic are converted to ids^s and iqs^s

    components by 3-phase to phase transformation. These are then converted to

    synchronously rotating frame by the unit vector components cos and sin before

    applying them to the de-qe machine model as shown. The controller makes two stages of

    inverse transformation, as shown, so that control currents ids* and iqs* corresponding to

    the machine currents ids and iqs, respectively. In addition, the unit vector assures correct

    alignment of ids current with r and iqs perpendicular to it, as shown. Note that the

    transformation and inverse transformation including inverter ideally do not incorporate

    any dynamics, and therefore, the response to ids and iqs is instantaneous.

    Figure 3.5

    Vector control implementation principle with machine de-qe model

  • 26

    There are essentially two general methods of vector control, one, called the direct or feedback

    method and indirect or feed forward method. The methods are different essentially by how the

    unit vector(cos and sin) is generated for the control.

    3.4 Conclusion

    Alignment of ids and iqs to field vector r along and perpendicularly is mandatory in these

    technique. We perform some transformations to convert these phase parameters of motor into 2-

    phase parameters, which aligned and perpendicular to field vector. We perform park-transform

    and inverse transform by using a DSP, and fed output of DSP to PWM inverter to control motor.

  • 27

    4. Park Transform

    The PARK transform is not something new. This theory has been around for 75 years. As we

    will see, this technique requires a large amount of mathematical calculations involving in

    particular matrix multiplications. Thanks to new control processor technologies, it becomes now

    possible to use this real-time control technique. Let us consider the voltage vector (VS ) applied

    to the stator of the three phase machine we are working on (ACI or PMSM). This theory is not

    limited to sinusoidal distribution and can be applied to any kind of vector. For now, we will

    consider the general case. The PARK transform is only a referential change defined as below:

    Where Vs1,Vs2,Vs3 are sinusoidal three-phase input voltages. And Vsd,Vsq,Vso are rotating

    reference frame parameters of a Induction machine. Vsd,Vsq,Vso are values, which we can get

    after park transform. Vsd is direct axis component and Vsq is quadrature axis component and

    Vso is null vector and always negligible. Vector representation is shown in fig 4.1.

    3

    2

    1

    )(

    S

    s

    s

    S

    v

    v

    v

    V

    3

    2

    1

    1

    3

    2

    1

    3

    2

    1

    )( and .)(

    1 )3

    4sin( )

    3

    4cos(

    1 )3

    2sin( )

    3

    2cos(

    1 sin cos

    S

    S

    s

    S

    So

    Sq

    sd

    so

    sq

    sd

    S

    S

    S

    s

    So

    Sq

    sd

    SS

    SS

    SS

    s

    s

    s

    v

    v

    v

    P

    v

    v

    v

    v

    v

    v

    P

    v

    v

    v

    v

    v

    v

    v

    v

    v

  • 28

    Fig 4.1

    PARK Transform

    Vsd,Vsq,Vso are park coordinates. and the properties of these are shown below

    (vsd, vsq, vso) are called the Park coordinates

    vsd: direct Park component

    vsq: squaring Park component

    vso: homo-polar Park component

    Vso is null for a three-phases balanced system

    Each pair of components is perpendicular to each other

    0.

    0.

    0.

    system) balanced phases-(tri 0321

    SoSq

    SoSd

    SqSd

    SSS

    vv

    vv

    vv

    vvv

  • 29

    The index S indicates that we work with the stator parameters. This referential change

    transforms the VS vector in a new vector as written below. PARK coordinates will play an

    important role in the FOC control from a regulation point of view. Instead of using the general

    PARK transform, literature prefers the normalized PARK transform for which inverted matrix is

    much easier to calculate and which allows building an orthogonal referential change. The

    normalized PARK transform is defined as above.

    4.1 Conclusion

    Park transform is key mathematical operation in vector control for induction motor. We can

    obtain the park by combination of clark transform and rotation of vectors with synchronous

    speed. DSP is mandatory to perform these mathematical operations according instantaneous

    values of motor parameters and to obtain good dynamic performance.

  • 30

    5. CLARKE Transform

    Park transform is mandatory mathematical operation in vector control method. But is some

    complex to perform. Clarke transform is easy to understand and implement. And rotation of

    vectors with synchronous speed after Clarke transform is results into park transform, and it is

    simpler park transform and save time and memory in DSP registers.

    We start from a three-phase balanced system that we first transform in a two-phase balanced

    system: this is the role of the CLARKE transform that defines a two-phase rotating frame (,

    )that rotates at the speed of the rotating stator magnetic field (S). If we sit on the rotating

    frame(, ) then we see stationary variables. This is the role of the S angle rotation that allows

    us to move from the rotating domain to the stationary domain. We can split park transform into

    Clarke and one rotation.

    The equations in Clarke transform are shown below

    Above V and V are results of Clarke transform. These are two-balanced values, which are 90

    degrees apart from each other. These are sinusoidal values. These are equivalent values in

    stationary reference frame of a induction machine. As shown in above equations, the V is align

    in the direction of V1 and perpendicular to V.

    We can get rotating reference model of a machine from these values by rotation with

    synchronous speed. The equations about rotation to get park transform from Clarke trans form

    are shown below. Vd,Vq are rotator reference frame parameters of machine and appear dc values

    in stationary reference frame.

    3

    .2 12

    1

    vvv

    vv

    v

    v

    SS

    SS

    qvd

    v

    )cos()sin(

    )sin()cos(

  • 31

    Fig 5.1

    Clarke-transform

    Fig 5.2 Park transform from Clarke and rotation

  • 32

    Conclusion

    Combining the CLARKE and PARK transforms as defined above, we move from the three phase

    rotating domain to the stationary domain: we just need to control DC quantities in real-time. To

    drive the power switches with new calculated values we have to re-transform these stationary

    control values back into the three phase rotating domain. This is done with a similar transform

    function called Inverse PARK. Obtaining d-q model parameters of machine using Clarke

    transform is simple compared to park transform and I it is simple to implement.

  • 33

    6. Space vector generation

    6.1 Description This chapter calculates the appropriate duty ratios needed to generate a

    given stator reference voltage using space vector PWM technique. The

    stator reference voltage is described by its (,) components, Ualpha and Ubeta

    Fig 6.1

    Space vector generation

    Availability This IQ module is available in one interface format:The C interface version

    Module Properties Type: Target Independent, Application Independent

    Target Devices: x281x or x280x

    C Version File Names: svgen_dq.c, svgen_dq.h

    IQmath library files for C: IQmathLib.h, IQmath.lib

  • 34

    Item C version Comments: Code Size(x281x/x280x) 256/256 words Data RAM

    6.2 C Interface

    6.2.1 Object Definition The structure of SVGENDQ object is defined by following structure definition

    typedef struct { _iq Ualpha; // Input: reference alpha-axis phase voltage

    _iq Ubeta; // Input: reference beta-axis phase voltage

    _iq Ta; // Output: reference phase-a switching function

    _iq Tb; // Output: reference phase-b switching function

    _iq Tc; // Output: reference phase-c switching function

    void (*calc)(); // Pointer to calculation function

    } SVGENDQ;

    typedef SVGENDQ *SVGENDQ_handle;

    here

    Ualpha: Component of reference stator voltage vector on direct axis stationary reference frame.

    Ubeta: Component of reference stator voltage vector on quadrature axis stationary reference

    frame

    Ta: Duty ratio of PWM1 (CMPR1 register value as a fraction of associated period register,

    TxPR, value).

    Tb: Duty ratio of PWM3 (CMPR2 register value as a fraction of associated period register,

    TxPR, value).

    Tc: Duty ratio of PWM5 (CMPR3 register value as a fraction of associated period register,

    TxPR, value).

    6.2.2 Special Constants and Data types

    SVGENDQ The module definition is created as a data type. This makes it convenient to instance an

    interface to space vector generator. To create multiple instances of the module simply

    declare variables of type SVGENDQ.

    SVGENDQ_ handle User defined Data type of pointer to SVGENDQ module

    SVGENDQ_DEFAULTS Structure symbolic constant to initialize SVGENDQ module. This provides the initial

  • 35

    values to the terminal variables as well as method pointers.

    6.2.3 Methods

    void svgendq_calc(SVGENDQ_handle); This definition implements one method viz., the space vector generator computation

    function. The input argument to this function is the module handle.

    Module Usage Instantiation The following example instances two SVGENDQ objects

    SVGENDQ svgen_dq1, svgen_dq2;

    Initialization

    To Instance pre-initialized objects

    SVGENDQ svgen_dq1 = SVGENDQ_DEFAULTS;

    SVGENDQ svgen_dq2 = SVGENDQ_DEFAULTS;

    Invoking the computation function svgen_dq1.calc(&svgen_dq1);

    svgen_dq2.calc(&svgen_dq2);

    Example The following pseudo code provides the information about the module usage.

    main()

    {

    }

    void interrupt periodic_ interrupt_ isr()

    {

    svgen_dq1.Ualpha = Ualpha1; // Pass inputs to svgen_dq1

    svgen_dq1.Ubeta = Ubeta1; // Pass inputs to svgen_dq1

    svgen_dq2.Ualpha = Ualpha2; // Pass inputs to svgen_dq2

    svgen_dq2.Ubeta = Ubeta2; // Pass inputs to svgen_dq2

    svgen_dq1.calc(&svgen_dq1); // Call compute function for svgen_dq1

    svgen_dq2.calc(&svgen_dq2); // Call compute function for svgen_dq2

    Ta1 = svgen_dq1.Ta; // Access the outputs of svgen_dq1

    Tb1 = svgen_dq1.Tb; // Access the outputs of svgen_dq1

    Tc1 = svgen_dq1.Tc; // Access the outputs of svgen_dq1

    Ta2 = svgen_dq2.Ta; // Access the outputs of svgen_dq2

    Tb2 = svgen_dq2.Tb; // Access the outputs of svgen_dq2

    Tc2 = svgen_dq2.Tc; // Access the outputs of svgen_dq2

    }

    6.3 Technical details The Space Vector Pulse Width Modulation (SVPWM) refers to a special switching sequence of

    the upper three power devices of a three-phase voltage source inverters(VSI) used in application

    such as AC induction and permanent magnet synchronous motor drives. This special switching

    scheme for the power devices results in 3 pseudo-sinusoidal currents in the stator phases. It has

    been shown that SVPWM generates less harmonic distortion in the output voltages or currents in

  • 36

    the windings of the motor load and provides more efficient use of DC supply voltage, in

    comparison to direct sinusoidal modulation technique. For the three phase power inverter

    configurations shown in Figure 6.1, there are eight possible combinations of on and off states of

    the upper power transistors. These combinations and the resulting instantaneous output line-to-

    line and phase voltages, for a dc bus voltage of VDC, are shown in Table 6.1

    Fig 6.1

    PWM Inverter

    C B A Van

    (Vdc/3)

    Vbn

    (Vdc/3)

    Vcn

    (Vdc/3)

    Vab

    (Vdc)

    Vbc

    (Vdc)

    Vca

    (Vdc)

    0 0 0 0 0 0 0 0 0

    0 0 1 2 -1 -1 1 0 -1

    0 1 0 -1 2 -1 -1 0 1

    0 1 1 1 1 -2 0 1 -1

    1 0 0 -1 -1 2 0 -1 0

    1 0 1 1 -2 1 1 0 -1

    1 1 0 -2 1 1 -1 0 1

    1 1 1 0 0 0 0 0 0

    Table 6.1

    Here A, B, C refers on-of states of upper SCR's.

  • 37

    6.4 Conclusion

    Three duty ratios Ta,Tb,Tc from space vector generation are fed to PWM to produce six gate

    pulses to inverter, which fed Induction motor. We use DSP, to perform this space vector

    generation

  • 38

    7.1 Inverse Park Transform

    7.1 Description

    This transformation projects vectors in orthogonal rotating reference frame into two phase

    orthogonal stationary frame.

    Fig 7.1

    Inverse park transform

    7.1.1 Availability:

    This IQ module is available in one interface format:

    1) The C interface version

    7.1.2 Module Properties :

    Type:Target Independent, Application Independent

    Target Devices: x281x or x280x

    C Version File Names: ipark.c, ipark.h

    IQmath library files for C: IQmathLib.h, IQmath.lib.

  • 39

    7.2 C Interface

    Object Definition

    The structure of IPARK object is defined by following structure definition.

    typedef struct { _iq Alpha; // Output: stationary d-axis stator variable

    _iq Beta; // Output: stationary q-axis stator variable

    _iq Angle; // Input: rotating angle (pu)

    _iq Ds; // Input: rotating d-axis stator variable

    _iq Qs; // Input: rotating q-axis stator variable

    void (*calc)(); // Pointer to calculation function

    } IPARK;

    typedef IPARK *IPARK_handle;

    7.3 Inputs and outputs of i-park transform

    Ds : Direct axis(D) component of transformed signal in rotating reference frame. Qs : Quadrature axis(Q) component of transformed signal in rotating reference frame.

    Angle: Phase angle between stationary and rotating frame.

    Alpha : Direct axis(d) component of the transformed signal

    Beta : Quadrature axis(q) component of the transformed signal

    7.4 Special Constants and Data types

    IPARK

    The module definition is created as a data type. This makes it convenient to instance an

    interface to the Inverse Park variable transformation. To create multiple instances of the

    module simply declare variables of type IPARK.

    IPARK_handle

    User defined Data type of pointer to IPARK module

    IPARK_DEFAULTS

    Structure symbolic constant to initialize IPARK module. This provides the initial values to

    the terminal variables as well as method pointers.

    7.5 Methods and usage

    void ipark_calc(IPARK_handle);

  • 40

    This definition implements one method viz., the inverse Park variable transformation

    computation function. The input argument to this function is the module handle.

    7.5.1Module Usage

    Instantiation: The following example instances two IPARK objects IPARK ipark1, ipark2;

    Initialization: To Instance pre-initialized objects

    IPARK ipark1 = IPARK_DEFAULTS;

    IPARK ipark2 = IPARK_DEFAULTS;

    Invoking the computation function: ipark1.calc(&ipark1);

    ipark2.calc(&ipark2);

    7.6 C-code Example

    The following pseudo code provides the information about the module usage.

    main()

    {

    }

    void interrupt periodic_interrupt_isr()

    {

    ipark1.Ds = de1; // Pass inputs to ipark1

    ipark1.Qs = qe1; // Pass inputs to ipark1

    ipark1.Angle = ang1; // Pass inputs to ipark1

    ipark2.Ds = de2; // Pass inputs to ipark2

    ipark2.Qs = qe2; // Pass inputs to ipark2

    ipark2.Angle = ang2; // Pass inputs to ipark2

    ipark1.calc(&ipark1); // Call compute function for ipark1

    ipark2.calc(&ipark2); // Call compute function for ipark2

    ds1 = ipark1.Alpha; // Access the outputs of ipark1

    qs1 = ipark1.Beta; // Access the outputs of ipark1

    ds2 = ipark2.Alpha; // Access the outputs of ipark2

    qs2 = ipark2.Beta; // Access the outputs of ipark2

    }

    7.7 Mathematical principles of I-park transform

    Inverse park transform coverts rotating reference frame variables to stationary reference frame.

    That it produce two-phase values from d-q parameters, by using some mathematical operations.

    The mathematical equations are shown below.

  • 41

    Id=ID*COS IQ*SIN

    Id=ID*SIN + IQ *COS

    Where Id,Iq are stationary reference frame parameters ands , IQ and ID rotating reference frame

    variables and inputs , and is angle between Id and ID. Figure 7.2 represents I-park transform of vectors ID,IQ into Iq, Id.

    Figure 7.2

    Inverse park transform

    7.8 Conclusion

    Inverse transform converts constant values in rotating reference frame variables into two-phase

    balanced values in stationary reference frame variables. Inverse transform is used to convert

    control variables in to two-phase balance values, which is fed to space vector generator to

    produce three driving PWM block of control operation

  • 42

    8. PULSE WIDTH MODULATION

    8.1 Introduction

    Space vector generation task produce required duty ratios of switching devices of inverter. So we

    need to produce suitable gate signals to SCRs, to attain duty ratios, produced by space vector

    generation task. So we perform PWM techniques to attain those triggering signals. This chapter

    deals about, conversion required duty ratios into six PWM signals by using DSP.

    Fig 8.1

    8.2 Description: This module converts any s/w variables with Q15 representation into the PWM signals in EVB for 281x or EPWM4-6 for 280x. Thus, it can be used to view the signal, represented by the

    variable, at the outputs of the PWM7, PWM9, PWM11 (for 281x) or EPWM4A, EPWM5A,

    EPWM6A (for 280x) pins through the external low-pass filters.

    Availability: This 16-bit module is available in one interface format:

    1) The C interface version

    Module Properties Type: Target Dependent, Application Independent

    Target Devices: x281x or x280x

    C Version File Names: f281xpwmdac.c, f281xpwmdac.h (for x281x) f280xpwmdac.c, f280xpwmdac.h (for x280x)

    IQmath library files for C: N/A

  • 43

    8.3 C Interface

    Object Definition:

    The structure of PWMDAC object is defined by following structure definition.

    typedef struct {

    int16 *PwmDacInPointer0; // Input: Pointer to source data output on PWMDAC ch 0

    int16 *PwmDacInPointer1; // Input: Pointer to source data output on PWMDAC ch 1

    int16 *PwmDacInPointer2; // Input: Pointer to source data output on PWMDAC ch 2

    Uint16 PeriodMax; // Parameter: PWMDAC half period in number of clocks (Q0)

    void (*init)(); // Pointer to the init function

    void (*update)(); // Pointer to the update function

    } PWMDAC;

    typedef PWMDAC *PWMDAC_handle;

    8.4 Special Constants and Data types

    PWMGEN: The module definition is created as a data type. This makes it convenient to instance an

    interface to the PWMGEN driver. To create multiple instances of the module simply

    declare variables of type PWMGEN.

    PWMGEN_ handle: User defined Data type of pointer to PWMGEN module

    PWMGEN_DEFAULTS: Structure symbolic constant to initialize PWMGEN module. This provides the initial values

    to the terminal variables as well as method pointers.

    8.5 Methods and usage

    void F281X_EV2_PWMDAC_Init(PWMDAC *);

    void F281X_EV2_PWMDAC_Update(PWMDAC *);

    void F280X_PWMDAC_Init(PWMDAC *);

    void F280X_PWMDAC_Update(PWMDAC *);

    This default definition of the object implements two methods the initialization and the runtime compute function for PWMDAC generation. This is implemented by means of a

    function pointer, and the initialiazer sets this to F281X_EV2_PWMDAC_Init and

    F281X_EV2_PWMDAC_Update functions for x281x or F280X_PWMDAC_Init and

    F280X_PWMDAC_Update functions for x280x. The argument to this function is the

  • 44

    address of the PWMDAC object.

    8.5.1 Module Usage

    Instantiation: The following example instances one PWMDAC object

    PWMDAC pwmdac1;

    Initialization: To Instance pre-initialized objects

    PWMDAC pwmdac1 = PWMDAC_DEFAULTS;

    Invoking the computation function: pwmdac1.init(&pwmdac1);

    pwmdac1.update(&pwmdac1);

    Example: The following pseudo code provides the information about the module usage.

    main()

    {

    pwmdac1.PeriodMax = 2500; // PWM frequency = 30 kHz, clock = 150 MHz

    pwmdac1.PwmDacInPointer0= &pwmdac_ch1_Q15;

    pwmdac1.PwmDacInPointer1= &pwmdac_ch2_Q15;

    pwmdac1.PwmDacInPointer2= &pwmdac_ch3_Q15;

    pwmdac1.init(&pwmdac1); // Call init function for pwmdac1

    }

    void interrupt periodic_interrupt_isr()

    {

    pwmdac_ch1_Q15 = (int)_IQtoIQ15(variable1_in_IQ);

    pwmdac_ch2_Q15 = (int)_IQtoIQ15(variable2_in_IQ);

    pwmdac_ch3_Q15 = (int)_IQtoIQ15(variable3_in_IQ);

    pwmdac1.update(&pwmdac1); // Call update function for pwmdac1

    }

    8.6 Technical Background This module converts any s/w variables with Q15 representation into the PWM signals in

    EVB for x281x by means of calculation the (full) compare values using Timer 3 for

    generating PWM outputs. For 280x devices, the EPWM4-6 will be used instead.

    Therefore, the external low-pass filters are necessary to view the actual signal waveforms

    as seen in Figure 1. The (1st-order) RC low-pass filter can be simply used for filter out the

    high frequency component embedded in the actual low frequency signals. To select R

    and C values, its time constant can be expressed in term of cut-off frequency (fc) as

    follow:

    = 1/(2** fc)= RC

  • 45

    8.7 Conclusion

    Duty ratios, which generated from space vector generation, are converted into six PWM

    triggering signals to fed PWM inverter. This task is performed by EZDSP necessary

    programming.

  • 46

    9. Hardware implementation

    9.1 Hardware laboratory setup

    Spectrum Digital EZDSP TMS320F2812

    Spectrum Digital DMC550 drive platform

    3-phase PMSM with a QEP encoder

    Applied Motion 40mm Alpha Motor

    Type: A0100-104-3-100

    240V DC power supply ( DC bus voltage )

    load

    PC parallel port to JTAG

    5V DC ( eZdsp )

    RS232 ( optional )

    Oscilloscope

    9.2 Circuit description

    The circuit of the project is shown in figure 9.1. The key component of the project is EZDSP. Its

    trade name is TMS320F2812. It fixed point processor. But parameters of motor and control

    parameters are float type values. So we use iq-math libraries to convert float point code into

    fixed point code.

    As shown in figure 9.1, majority operations are performed by F2812. The functions of DSP are

    1. ADC

    2. Clarke transform

    3. Park transform

    4. PI controller

    5. Inverse-park transform

    6. Space vector generation.

  • 47

    7. Pulse width modulation

    And we use a voltage source inverter to produce ac supply for induction motor. Induction motor

    is a target device in our project and objective is control this motor using vector control

    technique.

    15 - 33TMS320F28x controller

    Iq_ref v s*

    v s*

    Inv.

    Park

    Space

    Vector

    Gen.

    PWM

    Driver

    Ta

    Tb

    Tc

    Voltage

    Source

    Inverter

    IM

    ia

    ib

    Ileg2_

    Bus

    Driver

    ADCIN1

    ADCIN2

    ADCIN3i sPark Clarke

    i s

    ids*

    PI

    PI

    ANGLE

    iqs

    Encoder

    PWM1

    PWM2

    PWM3

    PWM4

    PWM5

    PWM6

    ids

    Id_ref

    vqs*

    vds*

    Fig 9.1

    Vector control of induction motor using EZDSP

  • 48

    9.3 Operation of project

    Now we describe about operation of project by step-by-step as shown below.

    9.3.1 ADC:

    In this step, as shown in the figure 9.1, the three analog current inputs from motor are fed to

    ADC. This consists two event mangers to convert two current values into two digital values at

    same time. We use 12-bit ADC in our project. Output ADC is fed to DSP to perform further

    operations.

    9.3.2 Clarke transform:

    This task is performed DSP. Clarke transform converts three-phase currents into balanced two -

    phase values, i.e it gives stationary reference model of a machine. We get two orthogonal values

    after Clarke transform as shown in figure 9.1. These two values are fed to park transform task to

    generate rotating reference frame variables of machine.

    9.3.3 Park transform:

    Objective of this task is generating rotating reference frame from stationary frame. This

    transform produce two values, which appear as dc values in reference frame. This transform

    converts balanced two-phase values into two dc values. The outputs from park transform, are

    compared with control variables as shown in the figure.

    9.3.4 PI control:

    This task is first compare the control variable and park-transform outputs. Then difference

    between them is fed PI control task. This error is integrated, and its gives a output, which is

    proportional and integration of error. This task also performed DSP. The output of this task is act

    as input to I-park task, which is performed by again DSP, as shown in the figure.

    9.3.4. Inverse park transform:

    This task is also performed by DSP. This transform converts fixed values from PI control, into

    two balanced orthogonal values. That is transform produce stationary frame variables from

    rotating reference frame. Figure 9.1 shows about this transformation. This outputs are fed to

    space vector generation task to produce duty ratios of SCR's.

  • 49

    9.3.5 Space vector generation:

    Space vector generation task produces duty ratio of SCR's from output I-park transform. This

    task also performed by DSP by using suitable code. This duty ratios are fed to PWM to produce

    required triggering pulses to SCR's. This task produces required duty ratios of SCR's to gain

    control of machine.

    9.3.6 PWM TECHNIQUE:

    This last task performed by DSP. In this task, we produce six triggering pulses to fed VSI

    according to required duty ratios from space vector generation task. Waveform shape of the

    signals is vary according changes in duty ratios values.

    9.3.7. Voltage source inverter:

    We use voltage source inverter to give supply to induction motor. DC BUS voltage should be

    more than AC voltage. The output of the inverter is depend on gate signals. We perform PWM

    technique to produce required gate pulses according to requirements, to gain control over the

    machine.

    9.3.10 Conclusion:

    As described above the vector control of induction motor is performed by DSP on code

    composer studio platform.

    9.4 Output waveforms

  • 50

    Input voltages

    Fig 9.2

  • 51

    Clarke waveform

    Fig 9.3

  • 52

    Park waveform

    Fig 9.3

  • 53

    Space vector generation waveform

    Fig 9.4

  • 54

    PWM waveform

    Fig 9.5

  • 55

    BLOCK DIAGRAM

    Fig 9.6

  • 56

    Ez-dsp board will be as shown in fig below

    Fig 9.7

  • 57

    TOTAL HARDWARE IMPLEMENTATION WILL BE AS SHOWN BELOW

  • 58

    REFERENCES

    1. Mohan/ unde land/ Robbins, Power Electronics: Converters, Applications and Design.

    2. Muhammad H.Rashid, Power Electronics: Circuits, Devices and applications

    3. MDSingh /Khanchandani, Power Electronics, Tata-Mcgrawhill publications.

    4.Bimal K.Bose, modern power electronics, Pearson education publications.

    5. Wikepedia.org, FOC of induction motor.

    6. Jorge Zambada, Nov. 8, 2007:Field-oriented control for

    motors, http://machinedesign.com/article/field-oriented-control-for-motors-1108

    7.Chuck Lewin, April 10, 2006: New Developments in Commutation and Motor Control

    Techniques

    8. Kedar Godbole, Texas Instruments, Sept 23, 2006: Field oriented control reduces

    motor size, cost and power consumption in industrial applications

    9. Naresh Kumar Sinha, 1986: Micro-processor based control systems, pg 161,

    175, http://books.google.com/books?id=JgalRre0L8wC&printsec=frontcover#v=onepage

    &q&f=false

  • 59

    FUTURE SCOPE

    By elaborating this procedure of space vector generation to pwm technique and by getting the

    feedback from the sensing devices we get the vector control of the a.c motor with the help of the

    inverters.

    APPENDIX

    PROGRAMME

    Watch Variables:

    Voltage1[256] Last 10 ADCRESULT0 values

    Voltage2[256] Last 10 ADCRESULT1 values

    voltage3[256] Last 10 ADCRESULT2 values

    current2[256] Last 10 ADCRESULT4 values

    current3[256] Last 10 ADCRESULT5 values

    ConversionCount Current result number 0-255

    LoopCount Idle loop counter

    Program:

    #include "DSP281x_Device.h"

    #include "DSP281x_Examples.h"

    #include "IQmathLib.h"

    #define offset 0x07FF

    interrupt void adc_isr(void);

    Uint16 LoopCount;

    Uint16 ConversionCount;

    int16 Gain;

    int16 Voltage1[256];

  • 60

    int16 Voltage2[256];

    int16 Voltage3[256];

    int16 current1[256];

    int16 current2[256];

    int16 current3[256];

    int16 Vas[256];

    int16 Vbs[256];

    int16 power[256];

    main()

    {

    InitSysCtrl();

    SysCtrlRegs.HISPCP.all = 0x3;

    EDIS;

    DINT;

    InitPieCtrl();

    IER = 0x0000;

    IFR = 0x0000;

    InitPieVectTable();

    EALLOW;

    PieVectTable.ADCINT = &adc_isr;

    EDIS;

    InitAdc();

    PieCtrlRegs.PIEIER1.bit.INTx6 = 1;

    IER |= M_INT1;

    EINT;

    ERTM;

    LoopCount = 0;

    ConversionCount = 0;

  • 61

    AdcRegs.ADCMAXCONV.all = 0x0005;

    AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0;

    AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0x1;

    AdcRegs.ADCCHSELSEQ1.bit.CONV02 = 0x2;

    AdcRegs.ADCCHSELSEQ1.bit.CONV03 = 0x3;

    AdcRegs.ADCCHSELSEQ2.bit.CONV04 = 0x4;

    AdcRegs.ADCCHSELSEQ2.bit.CONV05 = 0x5;

    AdcRegs.ADCTRL2.bit.EVA_SOC_SEQ1 = 1;

    AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1= 1;

    EvaRegs.T1CMPR = 0x0080;

    EvaRegs.T1PR = 0xFFFF;

    EvaRegs.GPTCONA.bit.T1TOADC = 1;

    EvaRegs.T1CON.all = 0x1042;

    while(1)

    {

    LoopCount++;

    }

    }

    interrupt void adc_isr(void)

    {

    Voltage1[ConversionCount] = (AdcRegs.ADCRESULT0 >>4) - offset;

    Voltage3[ConversionCount] = (AdcRegs.ADCRESULT2 >>4) - offset;

    Voltage2[ConversionCount] = - Voltage1[ConversionCount] - Voltage3[ConversionCount];

    current1[ConversionCount] = (AdcRegs.ADCRESULT3 >>4) - offset;

    current2[ConversionCount] = (AdcRegs.ADCRESULT4 >>4) - offset;

    current3[ConversionCount] = - current1[ConversionCount] - current2[ConversionCount];

    power[ConversionCount] =-( _IQmpy(Voltage1[ConversionCount],current1[ConversionCount]) +

  • 62

    _IQmpy(Voltage2[ConversionCount],current2[ConversionCount]) +

    _IQmpy(Voltage3[ConversionCount],current3[ConversionCount]));

    if(ConversionCount == 255)

    {

    ConversionCount = 0;

    }

    else ConversionCount++;

    Vas[ConversionCount] = Voltage1[ConversionCount];

    Vbs[ConversionCount] = _IQmpy((Voltage1[ConversionCount] +

    _IQmpy(_IQ(2),Voltage3[ConversionCount])),_IQ(0.57735026918963));

    Vas1[ConversionCount] = _IQmpy(Vd[ConversionCount],_IQ(0.866)) - _IQmpy(Vq[ConversionCount],_IQ(0.5));

    Vbs1[ConversionCount] = _IQmpy(Vq[ConversionCount],_IQ(0.866)) +

    _IQmpy(Vd[ConversionCount],_IQ(0.5));

    // Inverse clarke transformation

    Va[ConversionCount] = Vbs1[ConversionCount];

    Vb[ConversionCount] = _IQmpy(_IQ(-0.5),Vbs1[ConversionCount]) +

    _IQmpy(_IQ(0.8660254),Vas1[ConversionCount]); // 0.8660254 = sqrt(3)/2

    Vc[ConversionCount] = _IQmpy(_IQ(-0.5),Vbs1[ConversionCount]) -

    _IQmpy(_IQ(0.8660254),Vas1[ConversionCount]); // 0.8660254 = sqrt(3)/2

    // 60 degree Sector determination

    if (Va[ConversionCount]>_IQ(0))

    Sector = 1;

    if (Vb[ConversionCount]>_IQ(0))

    Sector = Sector + 2;

    if (Vc[ConversionCount]>_IQ(0))

    Sector = Sector + 4;

  • 63

    // X,Y,Z (Va,Vb,Vc) calculations

    Va[ConversionCount] = Vbs1[ConversionCount]; // X = Va

    Vb[ConversionCount] = _IQmpy(_IQ(0.5),Vbs1[ConversionCount]) +

    _IQmpy(_IQ(0.8660254),Vas1[ConversionCount]); // Y = Vb

    Vc[ConversionCount] = _IQmpy(_IQ(0.5),Vbs1[ConversionCount]) -

    _IQmpy(_IQ(0.8660254),Vas1[ConversionCount]); // Z = Vc

    if (Sector==0) // Sector 0: this is special case for (Ualpha,Ubeta) = (0,0)

    {

    Ta[ConversionCount] = _IQ(0.5);

    Tb[ConversionCount] = _IQ(0.5);

    Tc[ConversionCount] = _IQ(0.5);

    }

    if (Sector==1) // Sector 1: t1=Z and t2=Y (abc ---> Tb,Ta,Tc)

    {

    t1[ConversionCount] = Vc[ConversionCount];

    t2[ConversionCount] = Vb[ConversionCount];

    Tb[ConversionCount] = _IQmpy(_IQ(0.5),(_IQ(1)-t1[ConversionCount]-t2[ConversionCount])); // tbon =

    (1-t1-t2)/2

    Ta[ConversionCount] = Tb[ConversionCount]+t1[ConversionCount]; // taon = tbon+t1

    Tc[ConversionCount] = Ta[ConversionCount]+t2[ConversionCount]; // tcon = taon+t2

    }

    else if (Sector==2) // Sector 2: t1=Y and t2=-X (abc ---> Ta,Tc,Tb)

    {

    t1[ConversionCount] = Vb[ConversionCount];

    t2[ConversionCount] = -Va[ConversionCount];

    Ta[ConversionCount] = _IQmpy(_IQ(0.5),(_IQ(1)-t1[ConversionCount]-t2[ConversionCount])); // taon =

    (1-t1-t2)/2

    Tc[ConversionCount] = Ta[ConversionCount]+t1[ConversionCount]; // tcon = taon+t1

  • 64

    Tb[ConversionCount] = Tc[ConversionCount]+t2[ConversionCount]; // tbon = tcon+t2

    }

    else if (Sector==3) // Sector 3: t1=-Z and t2=X (abc ---> Ta,Tb,Tc)

    {

    t1[ConversionCount] = -Vc[ConversionCount];

    t2[ConversionCount]= Va[ConversionCount];

    Ta[ConversionCount] = _IQmpy(_IQ(0.5),(_IQ(1)-t1[ConversionCount]-t2[ConversionCount])); // taon =

    (1-t1-t2)/2

    Tb[ConversionCount] = Ta[ConversionCount]+t1[ConversionCount]; // tbon = taon+t1

    Tc[ConversionCount] = Tb[ConversionCount]+t2[ConversionCount]; // tcon = tbon+t2

    }

    else if (Sector==4) // Sector 4: t1=-X and t2=Z (abc ---> Tc,Tb,Ta)

    {

    t1[ConversionCount] = -Va[ConversionCount];

    t2[ConversionCount] = Vc[ConversionCount];

    Tc[ConversionCount] = _IQmpy(_IQ(0.5),(_IQ(1)-t1[ConversionCount]-t2[ConversionCount])); // tcon =

    (1-t1-t2)/2

    Tb[ConversionCount] = Tc[ConversionCount]+t1[ConversionCount]; // tbon = tcon+t1

    Ta[ConversionCount] = Tb[ConversionCount]+t2[ConversionCount]; // taon = tbon+t2

    }

    else if (Sector==5) // Sector 5: t1=X and t2=-Y (abc ---> Tb,Tc,Ta)

    {

    t1[ConversionCount] = Va[ConversionCount];

    t2[ConversionCount] = -Vb[ConversionCount];

    Tb[ConversionCount] = _IQmpy(_IQ(0.5),(_IQ(1)-t1[ConversionCount]-t2[ConversionCount])); // tbon =

    (1-t1-t2)/2

    Tc[ConversionCount]= Tb[ConversionCount]+t1[ConversionCount]; // tcon = tbon+t1

    Ta[ConversionCount] = Tc[ConversionCount]+t2[ConversionCount]; // taon = tcon+t2

    }

  • 65

    else if (Sector==6) // Sector 6: t1=-Y and t2=-Z (abc ---> Tc,Ta,Tb)

    {

    t1[ConversionCount] = -Vb[ConversionCount];

    t2[ConversionCount] = -Vc[ConversionCount];

    Tc[ConversionCount] = _IQmpy(_IQ(0.5),(_IQ(1)-t1[ConversionCount]-t2[ConversionCount])); // tcon =

    (1-t1-t2)/2

    Ta[ConversionCount] = Tc[ConversionCount]+t1[ConversionCount]; // taon = tcon+t1

    Tb[ConversionCount] = Ta[ConversionCount]+t2[ConversionCount]; // tbon = taon+t2

    }

    // Convert the unsigned GLOBAL_Q format (ranged (0,1)) -> signed GLOBAL_Q format (ranged (-1,1))

    Ta[ConversionCount] = _IQmpy(_IQ(2.0),(Ta[ConversionCount]-_IQ(0.5)));

    Tb[ConversionCount] = _IQmpy(_IQ(2.0),(Tb[ConversionCount]-_IQ(0.5)));

    Tc[ConversionCount] = _IQmpy(_IQ(2.0),(Tc[ConversionCount]-_IQ(0.5)));

    AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1;

    AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;

    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;

    return;

    }

  • 66

    CODE COMPOSER STUDIO

    Code Composer Studio (CCStudio) Integrated Development Environment (IDE) is a key

    element of the eXpressDSP Software and Development Tools strategy from Texas Instruments.

    CCStudio delivers all of the host tools and runtime software support for TMS320 DSP and

    OMAP based realtime embedded applications. CCStudios easy to use IDE allows DSP

    designers of all experience levels to move quickly through each phase of the application

    development process including design, code and build, debug, analyze and tune. The familiar

    tools and interfaces allow users to get started faster and become productive immediately. The

    IDE includes DSP/BIOS support, real-time analysis capabilities, debugger and optimization

    tools, C/C++ Compiler, Assembler, Linker, integrated CodeWright editor, visual project

    manager and a variety of simulators and emulation drivers. The developer can take advantage of

    timesaving, stress relieving productivity tools that get their applications to market quicker and

    take advantage of sophisticated debug tooling allowing them to find and fix real time issues.

    The tuning and optimization features enable developers to produce highly efficient

    applications taking full advantage of the device capabilities. Expected extension of a source file

    is .ASM for assembly and .C for C programs. The concept of COFF tools is to allow modular

    development of software independent of hardware concerns. An individual assembly language

    file is written to perform a single task and may be linked with several other tasks to achieve a

    more complex total system. Writing code in modular form permits code to be developed by

    several people working in parallel so the development cycle is shortened. Debugging and

    upgrading code is faster, since components of the system, rather than the entire system, is being

    operated upon. Also, new systems may be developed more rapidly if previously developed

    modules can be used in them.

    Code developed independently of hardware concerns increases the benefits of modularity

    by allowing the programmer to focus on the code and not waste time managing memory and

    moving code as other code components grow or shrink. A linker is invoked to allocate systems

    hardware to the modules desired to build a system. Changes in any or all modules, when re-

    linked, create a new hardware allocation, avoiding the possibility of memory resource conflicts.

  • 67

    Projects

    Code Composer works with a project paradigm. Essentially, within CCS a project for each

    executable program is created. Projects store all the information required to build the executable.

    For example, it lists things like: the source files, the header files, the target systems memory-

    map, and program build options

  • 68

    The project information is stored in a .PJT file, which is created and maintained by CCS. To

    create a new project, select the Project:New menu item.

    Along with the main Project menu, we can also manage open projects using the right-click

    popup menu. Either of these menus allows to Add Files to a project. We can also drag-n-drop

    files onto the project from Windows Explorer

    Procedure to create a new Project

    1. Double click on the Code Composer Studio icon on the desktop. Maximize Code Composer Studio to

    fill the screen. The menu bar (at the top) lists File ... HelpNote the horizontal tool bar below the menu bar

    and the vertical tool bar on the left-hand side

    2. A project is all the files needed to develop an executable output file which can be run on

    the DSP hardware. To create a new project for a lab. On the menu bar click Project. Type Lab2

    Source files (by reference) Source (C, assembly)

    LibrariesLibraries

    DSP/configurationDSP/BIOS configuration

    Linker filesLinker command files

    Project settings: Build Options (compiler and assembler)

    Build configurationsBuild configurations

    DSP/BIOSDSP/BIOS

    Linker

  • 69

    in the project name field and make sure the save in location is: C:\C28x\LABS\LAB2. This will

    create a .pjtfile which will invoke all the necessary tools (compiler, assembler, linker) to build

    the project. It will also create a debug folder that will hold immediate output files.

    3. Project Add Files to Project in the same lab exercise. Change the files of type to view C source files (*.c) and select Lab2.c and click OPEN. This will add the file Lab2.c to the newly

    created project.

    4. Add Lab2a.cmd to the project using the same procedure. This file will be edited during the lab

    exercise.

    5. Next, add the compiler run-time support library. To the

    project(C:\ti\c2000\cgtools\lib\rts2800_ml.lib).

    6. In the project window on the left click the plus sign (+) to the left of Project. Now,click on the

    plus sign next to Lab2.pjt. The Lab2a.cmd file is listed.Click on Source to see the current source

    file list (i.e. Lab2.c).

    Project Build Options

    7. There are numerous build options in the project. The default option settings are sufficient for

    getting started.

    Click: Project Build

    Options

    8. Select the Linker tab. The .out and .map files are created. The .out file is the executable code

    that will be loaded into the DSP. The .map file will contain a linker report showing memory

    usage and section addresses in memory.

    9. Set the Stack Size to 0x200. Select OK and then close the Build Options window.

    Edit the Linker Command File - Lab2a.cmd

    10. To open and edit Lab2a.cmd, double click on the filename in the project window.

    11. Edit the Memory{} declaration by describing the system memory shown on the

    Lab2a: Linker Command File slide

    12. In the sections{} area, a section called .reset has already been

    allocated. The .reset section is part of the rts2800_ml.lib, and is not needed. By

    putting the TYPE = DSECT modifier after its allocation, the linker will ignore

  • 70

    this section and not allocate it.

    13.Place the sections defined on the slide into the appropriate memories via the

    Sections{}area.

    Build and Load the Project

    14. The top four buttons on the horizontal toolbar control code generation.

    15. Code Composer Studio can automatically load the output file after a successful build.

    On the menu bar click: Option Customize and select the Program Load Options

    tab, check Load Program After Build, then click OK.

    16. Click the Build button and watch the tools run in the build window. Check for

    errors. When an error occurs, scroll the build window at the bottom of the Code Composer

    Studio screen until the error message (in red) is seen, and double-click the error message. The

    editor will automatically open the source file containing the error, and position the mouse cursor

    at the correct code line.

    17. Fix the error by adding a semicolon at the end of the "z = x + y" statement. For future

    knowledge, realize that a single code error can sometimes generate multiple error messages at

    build time.

    18. Rebuild the project (there should be no errors this time). The output file should automatically

    load. The Program Counter should be pointing to _c_int00 in the Disassembly Window.

    19. Under Debug on the menu bar click Go Main. This will run through the C-environment

    initialization routine in the rts2800_ml.lib and stop at main() in Lab2.c.

    Debug Environment Windows

    It is standard debug practice to watch local and global variables while debugging code. There are various

    methods for doing this in Code Composer Studio.

    Two of them are: memory windows, and watch windows.

    20. Open the memory window to view the global variable z.

    Click: View Memory on the menu bar.

    Code Composer Studio is case sensitive.

    Set the properties format to Hex TI style. This will give more viewable data in the window. Click OK to close the window property selection screen. The memory window will now open.

  • 71

    You can change the contents of any address in the memory window by double-clicking on its

    value. This is useful during debug.

    21. Open the watch window to view the local variables x and y.

    Click: View Watch Window on the menu bar.

    Click the Watch Locals tab and the local variables x and y are already present. The watch window will always contain the local variables for the code function currently being executed.

    (Note that local variables actually live on the stack. You can also view local variables in a

    memory window by setting the address to SP after the code function has been entered).

    22. We can also add global variables to the watch window if desired. To add the global variable z, click the Watch 1" tab at the bottom of the watch window. In the empty box in the "Name" column, type z. No ampersand is used here. Check that the watch window and memory window both report the same value for z. Changing the value in one window also changes the value in the other window.

  • 72

    The define The CCS Watch Window using #define

  • 73

    The Structures The CCS Watch Window using Structures