vbyf401

Upload: sreerag-kunnathu-sugathan

Post on 01-Jun-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 VbyF401

    1/24

    a V/F Controller on the ADMC401 AN401-24

    Analog Devices Inc., January 2000 Page 1 of 24

    a

    Constant Volts/Hertz Operation forVariable Speed Control of Induction

    Motors

    Software example of an Space Vector Modulationdriven Volts/Hertz converter with the ADMC401

    AN401-24

  • 8/9/2019 VbyF401

    2/24

    a V/F Controller on the ADMC401 AN401-24

    Analog Devices Inc., January 2000 Page 2 of 24

    Table of Contents

    SUMMARY...................................................................................................................... 3

    1 THE INDUCTION MACHINE....................................................................................3

    1.1 Theory / Construction ....................................................................................................................................31.1.1 Change of Speed ......................................................................................................................................5

    1.1.2 The Torque...............................................................................................................................................5

    1.1.3 Number-plate of the machine ...............................................................................................................6

    2 THE FREQUENCY CONVERTER............................................................................7

    2.1 The "standard" system - Hardware .............................................................................................................7

    2.2 The control-functions build up in the ADMC401........................................................................................8

    2.2.1 Basics - Standard .....................................................................................................................................82.2.2 Third-harmonic Injected ..........................................................................................................................9

    2.2.3 Space Vector Modulation SVM..........................................................................................................10

    2.2.4 Ramps / Boost........................................................................................................................................12

    3 THE V/F APPLICATION ROUTINES .....................................................................14

    3.1 Using the V/F Application Routines............................................................................................................14

    3.2 Configuring / resetting the PowerIRtrain: IR_reset_PIO3 ......................................................................15

    3.3 Ramps-module - Configuration of the Ramps: Ramps_Init_Speed_profile; ..........................................15

    3.4 Ramps-module - Setting the minimum speed: Set_Minimum_Speed;.....................................................16

    3.5 Ramps-module - Set the acceleration of the speed ramp: .........................................................................16

    3.6 V_F-module - Calculate Voltage and Angle: V_F_ctrl_Calculate_Angle_volt.......................................18

    3.7 V_F-module - Update the SVM and Dutycycles: V_F_ctrl_SVM_Calculation ......................................20

    4 SOFTWARE EXAMPLE: CONSTANT VOLT/HERTZ OPERATION - WITH SVMAND RAMPS ................................................................................................................ 20

    4.1 The main program: Main.dsp .....................................................................................................................20

    4.2 The main include file: main.h......................................................................................................................23

    5 REFERENCE.......................................................................................................... 24

  • 8/9/2019 VbyF401

    3/24

    a V/F Controller on the ADMC401 AN401-24

    Analog Devices Inc., January 2000 Page 3 of 24

    Summary

    This applications note describes how to control an ACIM with the use of a frequency converter. Thetheory behind the system and several different ways of speed-controlling an induction motor are

    discussed. Finally an example of control-schemes are described and illustrated in code.

    1 The induction Machine

    The induction machine is the most common motor today. It has been around for the last century and are

    therefor "the" motor in many applications. Besides being a well-known motor it is manufactured all overthe world - which makes it easy to find a dealer anywhere in the world. One of the reasons for being "the"

    motor of choice is that the induction will run directly on the distribution net, this has until today been themost important factor. Today speed controlling is a necessary and therefore different control applicationshave to be introduced.

    1.1 Theory / Construction

    The standard motor is designed with a short-circuiting rotor (on Figure 1done in aluminum) and a set ofcoils placed in the stator. The housing surrounds the complete "package" where the terminals for thestator-coils are accessible.

    Figure 1 - Photo of induction machine

    Looking at the motor from an electrical side, the ACIM consists of six coils, three coils in the stator andthree in the rotor (See Figure 2). Looking at these coils it is possible to make the electrical equivalent

    diagram for the machine. This equivalent is represented by reactance's and resistors, here X = 2fL [].

  • 8/9/2019 VbyF401

    4/24

    a V/F Controller on the ADMC401 AN401-24

    Analog Devices Inc., January 2000 Page 4 of 24

    Stator

    Rotor

    Figure 2 - Principal of Induction Machine

    L is the inductance and f is the frequency. The 2f = is in this case the current change per. time-unit.The coils in the rotor and stator are interacting on each other due to the common magnetic induction. Thisinteraction are described though RFE- iron core and hysteresis losses Xh- magnetic losses.

    RFE Xh

    R1 X2X1 R2/s

    I1

    Figure 3 - Equivalent circuit for one phase

    When the motor is loaded in the normal load area, the rotor-frequency will differ from the frequencymade from the rotational-field created on stator - the slip. In the equivalent this change can be describedas an adjustment of R'2with the factor 1/s (see Figure 4), where s = the slip.

    RFE Xh

    R1 X2X1 R2

    s

    sR

    1'2

    I1 I2

    Figure 4 - Equivalent circuit for one phase with load

  • 8/9/2019 VbyF401

    5/24

  • 8/9/2019 VbyF401

    6/24

  • 8/9/2019 VbyF401

    7/24

    a V/F Controller on the ADMC401 AN401-24

    Analog Devices Inc., January 2000 Page 7 of 24

    2 The Frequency Converter

    Since the development of power-electronics a new way of controlling the motor-speed has beenintroduced. This topology is based on changing the frequency and / or the amplitude voltage on themotor-windings. With this controllable frequency / voltage it is possible to achieve a high efficient speed-

    controller for induction motor. One thing to consider is the torque on the shaft. If the voltage added to the

    motor changes, the frequency also has to change to ensure torque on the shaft. Looking at the torque,expressed from the power (P) and the speed the following equation is given:

    f

    V*k

    s)(1p

    60*f

    9.55*cos*I*V*3*

    n

    9.55*PT =

    ==

    [7]

    This equation implies that if the ration between the voltage and the frequency are kept constant the torquealso stays constant. These terms are the ones used to implement the speed-controller for the induction-

    machine.

    2.1 The "standard" system - HardwareThe frequency converter can be build up in many different ways, depending on the topology andflexibility of the system. One of the ways, which has become the most common is the way illustrated

    below.

    Figure 7 - Principle of the controller

    As it can be seen at Figure 7 the system includes 4 basic blocks which are:

    I. A rectifier used to generate DC from the 1 or 3 phase distribution net.

    II. The intermediate circuit - incorporates the DC-link control. Different control-aspects can be takeninto account, such as PFC, DC-chopping or stabilization.

    III. An Inverter used to reproduce three controlled waveforms. In this case the output from theinverter is three 120-degree phase-shifted sine-shaped voltages.

  • 8/9/2019 VbyF401

    8/24

    a V/F Controller on the ADMC401 AN401-24

    Analog Devices Inc., January 2000 Page 8 of 24

    IV. Control-block - here all the necessary adjustment of the system are done. For the frequencyconverter this control-block controls the inverter to deliver the wanted waveforms to the motor,meaning the voltage to frequency ratio.

    Today many power-electronic companies manufacture integrated power devices, in this case the

    integration of the rectifiers, inverters and drive-circuit for the IGBT's are packaged in one or two chipsand can be bought as standalone devices with all the relevant electronics included. Such a device ischosen for this demo-application. The device is International Rectifiers PowIRtrain (IRPTXXX

    1) but any

    other power device could have been used.

    2.2 The control-functions build up in the ADMC401.

    In this section three different topologies of constant Voltage over Frequency control are discussed.

    Basically the induction motor needs a voltage-controlled input for the three phases. These three phasevoltages can be produced in many different ways. In this applications note the use of PWM controlledfrom the ADMC401 is utilized.

    In this section the theory behind basics, third-harmonic and Space-Vector-Modulated2 references are

    discussed.

    2.2.1 Basics - Standard

    The generation of the three-phase supply voltage is done on base of basic PWM generation3. In this case

    the three phase reference voltages are generated in the processor and though the PWM-block these pattern

    are used as input parameter for the Power Inverter.

    Figure 8 Sine, corresponding angle and PWM

    At Figure 8 the voltage reference for one of the three phases with corresponding angle and PWM areillustrated. The three-phase references VrefA, VrefB and VrefC can be expressed as:

    1For more information see http://www.irf.com/

    2For more information see applications note AN401-17

    3For more information see applications note AN401-3

  • 8/9/2019 VbyF401

    9/24

    a V/F Controller on the ADMC401 AN401-24

    Analog Devices Inc., January 2000 Page 9 of 24

    )3

    2tsin(U(t)uVrefC

    )3

    2tsin(U(t)uVrefB

    t)sin(U(t)uVrefA

    1t

    1s

    1r

    ==

    +==

    ==

    [8]

    where the displacement of the voltages are as expressed 120. These three-phase references can be useddirectly in this simple three-phase generation as control-voltages for the frequency converter withsinusoidal reference.

    2.2.2 Third-harmonic Injected

    One of the major disadvantages with sinusoidal PWM is the poor utilization of the DC-link voltage. The

    amplitude value of the first harmonic in the phase-voltage has a maximum of Vc/2 referring to an actualreference voltage, measured on the terminals to be 0.866.

    Netvoltage*0.866Netvoltage2

    3geMotorvolta == [9]

    One of the simple ways of extending the usage of the DC-link voltages is by adding an extra harmonic to

    the sinusoidal voltage reference. In this case the third harmonic are added which results in three phasereferences expressed as:

    6

    UU),sin(3Uu

    Where

    )tsin(3U)3

    2tsin(U(t)u(t)u(t)uVrefC

    )tsin(3U)3

    2tsin(U(t)u(t)u(t)uVrefB

    )tsin(3Ut)sin(U(t)u(t)u(t)uVrefA

    133o

    310s3t

    310s2s

    310s1r

    ==

    +=+==

    ++=+==

    +=+==

    t

    [10]

    By utilizing just the unity scaled sine as generation platform for the third harmonic, this results in amaximum amplitude of 0.886*Netvoltage. By adjusting this value by 15.5% a better utilization of the

    DC-bus voltage is achieved, meaning the efficiency from the distribution-net to the Power Inverter.

    %15.5100%2

    V

    2

    V

    3

    V ccc =

    [11]

  • 8/9/2019 VbyF401

    10/24

  • 8/9/2019 VbyF401

    11/24

    a V/F Controller on the ADMC401 AN401-24

    Analog Devices Inc., January 2000 Page 11 of 24

    It is known that a balanced three-phase set of voltages is represented in the stationary reference frame by

    a space vector of constant magnitude, equal to the amplitude of the voltages, and rotating with angularspeed = 2 f

    fRe . As can be seen at Figure 11,the eight possible states of an inverter are represented

    as two null-vectors and six active-state vectors forming a hexagon. SVM now approximates the rotatingreference vector in each switching cycle by switching between the two nearest active-state vectors and thenull-vectors. In order to maintain the effective switching frequency of the power devices at a minimum,the sequence of toggling between these vectors is organised such that only one leg is affected in everystep.

    It may be anticipated that the maximum obtainable output voltage is increased with ordinary SVM up to90% of the inverter capability. It is also a relatively easy task to improve this technique in order to reach

    full inverter capability.

    Vd/2

    Vd/2

    Vd0 A B C

    III

    IV

    V

    VI

    I

    II

    V1=(1,0,0)

    V2=(1,1,0)

    V4=(0,1,1)

    V5=(0,0,1) V6=(1,0,1)

    V0=(0,0,0)

    V7=(1,1,1)

    V3=(0,1,0)

    V

    b)a)

    Figure 11: a) Configuration of the switches in the state V1=(1,0,0),

    b) Representation of the inverter states in the stationary reference frame

    Plotting the control-angle with corresponding voltage-references is illustrated on Figure 12.The relationsbetween the voltage-reference the PWM-sequence can be seen on Figure 12 (2)

    Figure 12 - SVM with corresponding angle and PWM

  • 8/9/2019 VbyF401

    12/24

    a V/F Controller on the ADMC401 AN401-24

    Analog Devices Inc., January 2000 Page 12 of 24

    2.2.4 Ramps / Boost

    In every motor-application the need of controlling the speed is essential and depends on the system. For

    that reason speed set-points and required tracking ramps have to be controllable by the user.

    Max Voltage

    Max Speed

    Boost Speed

    Boost Voltage

    Per phase Motor Voltage

    Frequency of Motor

    Voltage (Hz)

    V/F ratio = 1 Volts rms/Hz

    Acceleration time

    Cut Speed

    Figure 13 - Ramps examples

    In Figure 13the ramp / boost profile for this example is illustrated. Basically the ramps are defined by amax. / boost. speed and a step time (acceleration). Setting these three parameters allows the user to define

    the profile of the ramp. In the code for the ADMC401 these ramps / profiles are coded and can be calledwhen needed. profiles are coded and can be called when needed. The mathematical description of theramps are described below:

    Here,

    PWM_freq : PWM update frequency.

    Number_of_Steps : How many steps are used in the ramp.

    Count_Init : Number of counts for correct acceleration time.Delta_Init : Step-size.are defined as, and result in:

    stepsNumber_of_

    PWM_freqCount_Div= [14]

    32768bit15,stepsNumber_of_

    bit15Delta_init == [15]

    For the voltage profile the syntax is the same,

    V_F_SCALE : Scaling factor for the V/F ratio.VOLT_SCALING : Voltage scaling factor (divisor of maximum voltage)Maximum_voltage : Set to 1 (0x7FFF);

    MAX_FREQ : Maximum frequency of the periodCUT_FREQ : Maximum frequency of the end slopeBOOST_FREQ : BOOST frequency of the period

    MIN_FREQ : MIN frequency of the periodand the mathematical description are:

  • 8/9/2019 VbyF401

    13/24

    a V/F Controller on the ADMC401 AN401-24

    Analog Devices Inc., January 2000 Page 13 of 24

    periodPWMCycles_

    1Increment,

    MAX_FREQ

    PWM_freqperiodPWMCycles_ == [16]

    NGVOLT_SCALI

    Bit15VoltageBoost = [17]

    MAX_FREQ

    BOOST_FREQ*bit15dBoost_spee = [18]

    MAX_FREQ

    CUT_FREQ*bit15dBoost_spee = [19]

    MAX_FREQ

    MAX_FREQ*bit15dBoost_spee = [20]

    All these general constants are defined in main.h and together with the associated macros (furtherdescription see code section) they enable the full RAMP / Boost control. A specific macro is done to

    calculate the acceleration speed anywhere in the code. The mathematical calculation of the parameters isdone in the "main.h" and the "v_f_ctrl.dsp" files.

  • 8/9/2019 VbyF401

    14/24

    a V/F Controller on the ADMC401 AN401-24

    Analog Devices Inc., January 2000 Page 14 of 24

    3 The V/F Application Routines

    3.1 Using the V/F Application Routines

    These application routines provide various functions that configure and enable the ADMC401 to controlan induction machine, with constant voltage over frequency ratio. With the use of ADIs Standard MotorControl Library (see Library Documentation File) a full space vector modulation and control scheme are

    performed on an induction machine. The routines are developed as easy-to-use blocks, which has to belinked with the used library functions to build the complete application software. The routines for this

    application consist of eight files.

    File name Usage

    Main.dsp (dsp,h)Set-up of the structure for the PWM generation. Define set-

    points in frequencies and voltages

    IR_Reset (dsp, h) Reset the PowerIRtrain with the use of PIO3

    Ramp (dsp,h)Speed profile - Define and calculate the acceleration and

    ramp-profile for the speed.

    V_F_Ctrl (dsp,h)Voltage over frequency profile - Define the voltage amplitude

    and generate the given SVPWM scheme.

    Table 1: Files used with the V_F application routines

    As with the structure from the ADIs Standard Motor Control Library, macros are defined. For thisapplication six macros are used for configuration and update in the code. The following table reassumes

    the set of macros that are defined with this application.

    Operation Usage

    Configuration of the IR_Reset IR_reset_PIO3;

    Configuration of the Ramps Ramps_Init_Speed_profile;

    Set the minimum speed Set_Minimum_Speed;

    Set the acceleration of the speed ramp Ramps_Calculate_Speed_Profile(EXP,NOM)

    Calculate the projecting voltage and angle V_F_ctrl_Calculate_Angle_volt

    Update the SVM and calculate duty-cycle V_F_ctrl_SVM_Calculation

    Table 2: Implemented routines for the V_F Controller

    As already mentioned in the theory, these routines require some configuration constants, which aredeclared in a dedicated section of the main include-file "main.h". If a routine require internalconfiguration constants are declared in the associated include-file "Ramps.h", "V_F_CTRL.h" or

    "IR_reset.h". The following section will explain each of the routines in details linked with the relevantsegments of code that are found in any of the files described in Table 1.

  • 8/9/2019 VbyF401

    15/24

    a V/F Controller on the ADMC401 AN401-24

    Analog Devices Inc., January 2000 Page 15 of 24

    3.2 Configuring / resetting the PowerIRtrain: IR_reset_PIO3

    This macro initializes and resets the PowerIRtrain though PIO3. It checks the SYSSTAT(0) bit to clarify

    the status of the PWMTRIP pin. If a PWMTRIP is detected the routine resets the PowerIRtrain thoughPIO3. The routine is as described below - the nacros Set_Bit_DM , Clear_Bit_DM, Clear_Bit_DM,Test_Bit_DM and If_Clr_Jump are macros defined in the general purpose macro file "macro.h".

    Ir_reset_PIO3_:

    Set_Bit_DM(PIODIR0, 3); { configure PIO(3) as output }Clear_Bit_DM(PIOINTEN0, 3); { disable PIO interrupt 3 }

    rst:Set_Bit_DM(PIODATA0, 3); { set PIO(3) high to reset the PowIRtrain }

    { wait 10 usec }cntr = 150;do IR_delay until ce;nop;

    IR_delay: nop;Clear_Bit_DM(PIODATA0, 3); { set PIO(3) low to enable the PowIRtrain }

    { wait 100 usec }

    cntr = 1500;do IR_delay2 until ce;nop;

    IR_delay2: nop;

    wait_IR:Test_Bit_DM(SYSSTAT,0); { wait for PowIRtrain fault output to be }

    { deserted i.e. high }If_Clr_Jump(rst);

    rts;

    .ENDMOD;

    The call of the Ir_reset_PIO3 macro are defined as following:

    .MACRO ir_reset_PIO3;call ir_reset_PIO3_;

    .ENDMACRO;

    3.3 Ramps-module - Configuration of the Ramps: Ramps_Init_Speed_profile;

    The macro that configures the initialization of the Ramp module is defined to clear the input to theroutine. The Ramps_Init_Speed_profilemacro calls the Ramps_Init_Speed_profile_ routine and clears

    all input values

    Ramps_Init_Speed_profile_:

    ar = 0;dm(speed_command) = ar;dm(speed_profile) = ar;dm(count) = ar;dm(delta) = ar;

    RTS;

  • 8/9/2019 VbyF401

    16/24

    a V/F Controller on the ADMC401 AN401-24

    Analog Devices Inc., January 2000 Page 16 of 24

    3.4 Ramps-module - Setting the minimum speed: Set_Minimum_Speed;

    This macro checks the setting of the minimum speed. If the speed command is less than the minimum

    speed, the speed command is set to the minimum chosen speed. The Set_Minimum_Speedmacro callsthe Set_Minimum_Speed_ routine and returns to subroutine.

    Set_Minimum_Speed_:

    ar = abs ar; { Check if speed is in the minimum speed range }ay0 = Minimum_speed;ar = ar - ay0;if ge jump Over_Min_Speed; { if speed_Command< Minspeed jump Over_Min_Speed}

    my0 = Minimum_speed;dm(Speed_command) = my0;

    Over_Min_Speed:

    RTS;

    3.5 Ramps-module - Set the acceleration of the speed ramp:

    The Ramps_Calculate_Speed_Profile(EXP,NOM) macro controls the acceleration ramps input to theramps_Speed_Profiles_ routine. With the use of this macro the acceleration can be changed for anywhere

    in the code. The routine expects some constants defined in "main.h" as already discussed in section 2.2.4and illustrated in the section below. These constants are the number of steps in the ramp, the countnumber for the timescaling and the stepsize.

    {**************************************************************************************}* ** Constants that need to be defined in main.h: ** **.CONST Number_of_Steps = xxx; Number of steps in the ramp **.CONST Count_div = (PWM_freq/Number_of_Steps);Count number for timescaling **.CONST Delta_Init = xxx; stepsize for the speedsteps *

    ***************************************************************************************}With these values declared, the ramp definition and calculation can be done in theRamps_Speed_Profiles_ routine.

    Change the speed set point using a ramp profile. When a speed change is requested, produce a ramp, which

    takes the chosen acceleration-time to get to next speed level. The input value for this ramp generator is the

    value stored in init_count and the constant Delta_Init calculated in "main.h". The routine checks the

    speed_commandvalue. Is the value less than the last calculated speed_profilethe value is decreased. If the

    value of speed_commandis bigger than last calculation the speed_profileare increased.

    Ramps_Speed_Profiles_:

    ar = dm(count); { if count is 0,then calculate the speed profile}ar = pass ar; { Other wise decrement count and quit. }if eq jump calc_profile;

    ar = ar - 1;dm(count) = ar;jump End_Profile;

    Calc_Profile:ar = dm(init_count);dm(count) = ar;ar = Delta_Init; { Calculated in the main.h }dm(delta)=AR;

    ar = dm(speed_command);ay0 = dm(speed_profile);

  • 8/9/2019 VbyF401

    17/24

  • 8/9/2019 VbyF401

    18/24

    a V/F Controller on the ADMC401 AN401-24

    Analog Devices Inc., January 2000 Page 18 of 24

    3.6 V_F-module - Calculate Voltage and Angle: V_F_ctrl_Calculate_Angle_volt

    This macro V_F_ctrl_Calculate_Angle_volt controls the voltage profile to the motor. As in the other

    modules, constants are defined in the "main.h" file to enable control of the profile. As already discussedin section 2.2.4 these constants defines the profile illustrated on Figure 13. The constants are as can beseen on the figure: Voltage and Frequency related and are described below.

    {**************************************************************************************** Constants that need to be defined in main.h: **.CONST V_F_SCALE = xxx; To get X in Scaling factor ** Calculation (Gain of 8 in code) **.CONST VOLT_SCALING = xxx; Voltage scaling factor (divisor of V) ** **.CONST Maximum_voltage = xxx; **.CONST MAX_FREQ = xxx; Maximum frequency of the sine pwm **.CONST CUT_FREQ = xxx; Maximum frequency of the end slope **.CONST BOOST_FREQ = xxx; BOOST frequency of the sine pwm **.CONST MIN_FREQ = xxx; MIN frequency of the sine pwm ** ****************************************************************************************}

    From these values, the calculated constants for the voltage profile are defined and ready to use in the

    related code. The complexity of the equations is easy to understand comparing with those of section 2.2.4.

    .CONST PWMCycles_period = (PWM_freq/MAX_FREQ); { Number of pwm cycles pr period }

    .CONST INCREMENT = 0x10000 / PWMCycles_period; { Angle increment at MAX_FREQ }

    .CONST Boost_voltage = 0x7FFF / VOLT_SCALING; { XX % Of maximum voltage }

    .CONST Boost_speed = 0x7FFF / MAX_FREQ * BOOST_FREQ; { In this case 30 Hz }

    .CONST Maximum_speed = MAX_FREQ / MAX_FREQ *0x7FFF; { The Maximum_speed }

    .CONST Cut_Speed = 0x7FFF / MAX_FREQ * CUT_FREQ; { The Cut_speed }

    The macro itself calls the V_F_ctrl_Calculate_Angle_volt_ routine which and returns with d/q voltage

    references for the space vector modulation.

    The routine consists of two parts. First section calculates the angle on base of the calculated angle

    increment (Increment) and the speed_profilereturned from the Ramps_Calculate_Speed_Profile macro.

    V_F_ctrl_CALCULATE_ANGLE_VOLT_: mr = 0; { Clear mr } mr1 = dm(Theta); { Preload Theta } mx0 = dm(Speed_Profile); { Load Speed profile signal } my0 = Increment; mr = mr + mx0*my0 (SS); { Compute new angle & store } dm(Theta) = mr1;

    Second section of the routine checks the Speed_profile and depending on the selected speed_profile seeFigure 13 the voltage is projected. Due to the SVM

    5, the voltage is applied in the d/q-frame and not the

    standard three-phase frame. On additional parameter is included this code (V_F_SCALE) - The scalingof voltages compared to the speed. By this meaning not an even ration of Voltage over Frequency

    operation.

    EX. The motor needs to run from 0 to 120 Hz but the applied voltage has to be max. at 60 Hz. (see

    Figure 13). In this case the ratio of V/F is not one but two. This means that the slope actually hasto be twice the size. For that reason a gain factor V_F_SCALE ("main.h") is introduced. Thisfactor controls the scaling of the V/F (In the code an extra scaling of 8 is done to overcome higher

    frequencies).

    5For further information see AN401-11,17

  • 8/9/2019 VbyF401

    19/24

    a V/F Controller on the ADMC401 AN401-24

    Analog Devices Inc., January 2000 Page 19 of 24

    Boost_Frequency:

    ar = dm(Speed_Profile);ar = abs ar; { Check if speed is in the minimum speed range }ay0 = Boost_speed;ar = ar - ay0;if ge jump Over_Boost_Frequency;

    { if speed_profile=>Boost_speed jump Over_Boost_Frequency }my0 = Boost_voltage;dm(voltage_profile) = my0;

    DM(Vdq_ref)= my0; { Set constant Vdq reference (Voltage_profile,0) }ar = pass 0;DM(Vdq_ref+1)= ar;

    JUMP Out_of_Voltage_setting;

    Over_Boost_Frequency:

    ar = dm(Speed_Profile);ar = abs ar; { Check if speed is in the minimum speed range }ay0 = Cut_Speed;ar = ar - ay0;if ge jump Max_voltage; { if speed_profile = Speedcommand jump Boost_added }

    ar = dm(Speed_Profile); { Load Speed profile signal }my0 = V_F_SCALE; { V_F_SCALE }mr = ar*my0 (SS); { Compute new angle & store }sr=LSHIFT mr1 by 3 (LO); { shift 3 to multiply v_f ratio with 8 }

    my0 = sr0;dm(voltage_profile) = my0;

    DM(Vdq_ref)= my0; { Set constant Vdq reference (Voltage_profile,0) }ar = pass 0;DM(Vdq_ref+1)= ar;

    JUMP Out_of_Voltage_setting;

    Max_voltage:my0 = Maximum_voltage;dm(voltage_profile) = my0;

    DM(Vdq_ref)= my0; { Set constant Vdq reference (Voltage_profile,0) }ar = pass 0;DM(Vdq_ref+1)= ar;

    Out_of_Voltage_setting:

    RTS;

  • 8/9/2019 VbyF401

    20/24

    a V/F Controller on the ADMC401 AN401-24

    Analog Devices Inc., January 2000 Page 20 of 24

    3.7 V_F-module - Update the SVM and Dutycycles: V_F_ctrl_SVM_Calculation

    The final macro in the V_F-module is the V_F_ctrl_SVM_Calculation. This macro takes angle and the

    Vdq_references returned from the V_F_ctrl_Calculate_Angle_volt macro and calculate the dutycycles ofthe SVM

    6. The routine that the macro calls is described below.

    V_F_ctrl_SVM_CALCULATION_:

    {*******************************************************************************************}{ Set up SVM-module for transformation and SVM-generated PWM }{*******************************************************************************************}

    mr1 = dm(Theta); { control angle }refframe_Set_DAG_registers_for_transformations;refframe_Forward_Park_angle(Vdq_ref,Valphabeta_ref,mr1);{ generate Vreference in }

    { alpha-beta frame }

    SVPWM_Calc_Ontimes(Valphabeta_ref, OnTime_struct); { use SVPWM routines }SVPWM_Calc_Dutycycles(OnTime_struct, Dutycycles_struct);SVPWM_Update_DutyCycles(Dutycycles_struct);

    RTS;.ENDMOD;

    4 Software Example: Constant Volt/Hertz operation - With SVM andRamps

    As talked about though this and other applications notes the V/F operation of the induction machine iscommonly used in many variable speed-drives. This example combines all the application-modulesdiscussed in this applications note. The program reads a value from the converter and returns 6 dutycycles

    patterns on the PWM-block of the ADMC401. In combination with this software, some additional

    hardware has to be used. For autocalibrating the converter see AN401-05, some references are needed andto amplify the output signals from the ADMC401-Eval Board some kind of Power Inverter has to be

    selected. For this specific example the Power Inverter is from International Rectifier (PowerIRtrain -serie).

    4.1 The main program: Main.dsp

    The file main.dsp contains the initialisation and PWM Sync and Trip interrupt service routines. Toactivate, build the executable file using the attached build.bateither within your DOS prompt or clickingon it from Windows Explorer. This will create the object files and the main.exe example file. This filemay be run on the Motion Control Debugger.

    In the following, a brief description of this is given.

    Start of code declaring start location in program memory.MODULE/RAM/SEG=USER_PM1/ABS=0x60 Main_Program;

    Next, the general systems constants and PWM configuration constants (main.h see the next section) are

    included. Also included are the Library functions for the PWM, ADC, DAC, Transformations to D/Q - Alpha

    / Beta, SVM and of course the applications specific routines - IR_reset, ramps and v_f_ctrl.

    6For further information see AN401-17

  • 8/9/2019 VbyF401

    21/24

    a V/F Controller on the ADMC401 AN401-24

    Analog Devices Inc., January 2000 Page 21 of 24

    {**************************************************************************************** Include General System Parameters and Libraries ****************************************************************************************}

    #include ;

    #include ;

    #include ;

    #include ;

    #include ;#include ;

    #include ; { Application Specific Module }#include ; { Application Specific Module }#include ; { Application Specific Module }

    First the Resetting of the PowerIRtrain is activated. Followed by the PWM block initialisation. Note how the

    interrupt vectors for the PWMSync and PWMTrip service routines are passed as arguments. Then

    initialisation of the ADC and DAC block is completed. The next step is to initialise the profiles used in the

    speed definition. As the final thing in the start-up sequence the interrupt IRQ2 is enabled by setting the

    corresponding bit in the IMASK register after this the program enters a loop which just waits for interrupts.

    {**************************************************************************************}{ Start of program code }{**************************************************************************************}

    Startup:

    IR_reset_PIO3; { Reset PowIRTrain Module }

    PWM_Init(PWMSYNC_ISR, PWMTRIP_ISR);

    Ramps_Init_Speed_profile;

    IFC = 0x80; { Clear any pending IRQ2 inter. }

    ay0 = 0x200; { unmask irq2 interrupts. }ar = IMASK;ar = ar or ay0;IMASK = ar; { IRQ2 ints fully enabled here }

    ADC_Init; { Calibrates the ADC block. This calibration requires }{ values from the ADC and so the PWMSYNC must be }{ running when it is called. }{ Thus, ADC_init is placed after IRQ2 is enabled }

    DAC_Init;

    Main: { Wait for interrupt to occur }jump Main;

    rts;

    The first thing that is the DAC is paused to ensure no pointer conflict. The Speed_command is read though

    the converter on ADC1 and used as set-point for the control. With the call of Set_Minimum_Speed the

    minimum selected speed (see "main.h") is selected. Using ramps_Calculate_Speed_Profile(0x5,0x4fff) the

    acceleration time is set to 20 seconds and from here the Speed_profile value is used to calculate the Angle

    and the Voltages. Finally the complete PWM sequence is calculated with the use of v

    V_F_ctrl_SVM_Calculation.

  • 8/9/2019 VbyF401

    22/24

    a V/F Controller on the ADMC401 AN401-24

    Analog Devices Inc., January 2000 Page 22 of 24

    {**************************************************************************************}{ PWM Interrupt Service Routine }{**************************************************************************************}PWMSYNC_ISR:

    DAC_Pause; { Required only when I1, M1 or L1 is used }

    ADC_Read(ADC0, Offset_0to3); { Use ADC converter on ADCM401 } DM(Speed_command) = ar; { Store in Speed_command }

    Set_Minimum_Speed; { Set the minimum speed }ramps_Calculate_Speed_Profile(0x5,0x4fff); { 20 sec. see ramps.h }

    V_F_ctrl_Calculate_Angle_volt;V_F_ctrl_SVM_Calculation;

    DAC_resume;

    my0 = DM(VrefA);mx0 = 0x8;my0 = DM(Dutycycles_struct ); mr = mx0 * my0 (SS); Dac_Put(1, mr0);my0 = DM(Dutycycles_struct+1); mr = mx0 * my0 (SS); Dac_Put(2, mr0);my0 = DM(Dutycycles_struct+2); mr = mx0 * my0 (SS); Dac_Put(3, mr0);

    my0 = DM(theta); Dac_Put(4, my0);my0 = DM(Speed_Profile); Dac_Put(5, my0);

    my0 = DM(Valphabeta_ref ); Dac_Put(6, my0);my0 = DM(Valphabeta_ref+1); Dac_Put(7, my0);

    DAC_Update;

    RTI;

    The PWM-Trip routine is in this example used to check on the trip pin on the PowerIR-train 7. This TRIP-pin

    is hardwired to the PWM_TRIP_PIN on the ADMC401 device. When the PowerIRtrains pin goes low, in the

    case of over-currentor temperature the PWMTRIP_ISR check on the status of the pin. The actions are as

    given

    1. Check the PWMTRIP in the SYSSTAT if high jump to restart

    2. If not wait 80 s and then check SYSSTAT again3. If it now has gone high call restart PWM ..

    PWMTRIP_ISR:

    Test_Bit_DM(SYSSTAT,0); { check the PWMTRIP input... }If_Set_Jump(RESTART_PWM); { if it has gone high, restart the PWM block }

    CNTR = H#3FF ;DO Wait0 UNTIL CE; { wait 80us }

    Wait0: NOP;

    Test_Bit_DM(SYSSTAT,0); { check the PWMTRIP input again... }If_Set_Jump(RESTART_PWM);

    { if it has gone high, restart the PWM block }DIS SEC_REG;

    RTI;

    {**************************************************************************************}{ After a shutdown - restart the PWM. }{**************************************************************************************}

    7For more information look in datasheet on IRPTXXX family at www.irf.com

  • 8/9/2019 VbyF401

    23/24

    a V/F Controller on the ADMC401 AN401-24

    Analog Devices Inc., January 2000 Page 23 of 24

    RESTART_PWM:

    CNTR = H#3FF;DO Wait20 UNTIL CE; { wait 80us }

    Wait20: NOP;

    IFC = 0X80; { clear IRQ2 interrupt }PWM_Init(PWMSYNC_ISR, PWMTRIP_ISR);

    AR = 0; { clear SPEED_PROFILE to ensure SAFE start }DM(SPEED_PROFILE)=AR;

    RTI;

    .ENDMOD;

    4.2 The main include file: main.h

    This file contains the definitions of ADMC401 constants, general-purpose macros and the configurationparameters of the system and library routines. It should be included in every application. For more

    information refer to the The Library Documentation File document.

    This file is mostly self-explaining. The relevant sections to this example are shown here. The frequency of the

    used crystal (12.96MHz in case of the ADMC401 Evaluation Kit) is expressed in kHz. Then ADMC401specific constants, ROM-Utilities and general-purpose macros are included. Refer to the ADMC401

    documentation for details on the ROM-Utilities.{**************************************************************************************** General System Parameters and Constants ****************************************************************************************}

    .CONST Cry_clock = 12960; {Crystal clock frequency [kHz] }

    #include ;#include ;

    As described in the The Library Documentation File, every library routine has a section in main.h for its

    configuration parameters. The following defines the parameters for the RAMPS and V_F_CTRL block used

    in this example.{**************************************************************************************}{ Library: RAMP BLOCK }{ file : Ramp.dsp }{ Application Note: V/F control with the ADMC401 }.CONST Number_of_Steps = 256; { Number of steps in the ramp 8 bit }.CONST Count_div = (PWM_freq/Number_of_Steps); { Count number for timescaling}.CONST Delta_Init = (32768/Number_of_Steps) ; { stepsize for the speedsteps }

    {**************************************************************************************}

    {**************************************************************************************}{ Library: V_F_CTRL BLOCK }{ file : V_F_CTRL.dsp }{ Application Note: V/f control with the ADMC401 }

    .CONST V_F_SCALE = 0x1000; { To get 1 in scaling factor 60Hz/60Hz }{ calculation (Gain of 8 in code) }

    .CONST VOLT_SCALING = 6; { Voltage scaling factor (divisor of V) }

    .CONST Maximum_voltage = 0x7FFF;

    .CONST MAX_FREQ = 60; { Maximum frequency of the sine pwm }

    .CONST CUT_FREQ = 60; { Maximum frequency of the end slope }

    .CONST BOOST_FREQ = 10; { BOOST frequency of the sine pwm }

    .CONST MIN_FREQ = 6; { MIN frequency of the sine pwm }

    {**************************************************************************************}

  • 8/9/2019 VbyF401

    24/24

    a V/F Controller on the ADMC401 AN401-24

    5 Reference

    [1] A Tutorial in AC Induction and Permanent Magnet Synchronous Motors. Analog Devices Inc. '94.