Você está na página 1de 25

a V/F controller on the ADMC401

Application Note: AN401-24

a
Constant Volts/Hertz Operation for Variable Speed Control of Induction Motors
Software example of an Space Vector Modulation driven Volts/Hertz converter with the ADMC401

10/25/99

Page 1 of 25

a V/F controller on the ADMC401

Application Note: AN401-24

Contents
SUMMARY 1 THE INDUCTION MACHINE 3 3
3 5 5 6

1.1 Theory / Construction 1.1.1 Change of Speed 1.1.2 The Torque 1.1.3 Number-plate of the machine

2
2.1

THE FREQUENCY CONVERTER


The "standard" system - Hardware

7
7 8 8 9 10 12

2.2 The control-functions build up in the ADMC401. 2.2.1 Basics - Standard 2.2.2 Third-harmonic Injected 2.2.3 Space Vector Modulation SVM 2.2.4 Ramps / Boost

3
3.1 3.2 3.3

SOFTWARE EXAMPLE
Using the V/F routines and accessories Utilizing the V/F library: An example The IR_RESET interface and implementation.

13
13 14 17 18 18 18 21 22 22 23

3.4 Using the ramp generator. 3.4.1 The ramp generator Interface 3.4.2 Implementation of the ramp routines. 3.5 The V_F_PROFILES module 3.5.1 Using the CALCULATE_ANGLE 3.5.1.1 Boost 3.5.2 Using the SVM_CALCULATION

REFERENCE

25

10/25/99

Page 2 of 25

a V/F controller on the ADMC401

Application Note: AN401-24

Summary
This applications note describes how to control an ACIM with the use of a frequency converter. The theory 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 over the 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 the most important factor. Today speed controlling is a necessary and therefore different control applications have to be introduced. 1.1 Theory / Construction The standard motor is designed with a short-circuiting rotor (on Figure 1-1 done in aluminum) and a set of coils placed in the stator. The housing surrounds the complete "package" where the terminals for the stator-coils are accessible.

Figure 1-1 - Photo of induction machine

Looking at the motor from an electrical side, the ACIM consists of six coils, three coils in the stator and three in the rotor (See Figure 1-2). Looking at these coils it is possible to make the electrical equivalent diagram for the machine. This equivalent is represented by reactances

10/25/99

Page 3 of 25

a V/F controller on the ADMC401

Application Note: AN401-24

Stator

Rotor

Figure 1-2 - Principal of Induction Machine

and resistors, here X = 2fL []. L is the inductance and f is the frequency. The 2f = is in this case the current change pr. time-unit. The coils in the rotor and stator are interacting on each other due to the common magnetic induction. This interaction are described though RFE iron core and hysteresis losses Xh - magnetic losses. R1 X1 X2 R2/s
I1 RFE Xh

Figure 1-3 - Equivalent circuit for one phase

When the motor is loaded in the normal load area, the rotor-frequency will differ from the frequency made from the rotational-field created on stator - the slip. In the equivalent this change can be described as an adjustment of R'2 with the factor 1/s (see Figure 1-4), where s = the slip.
R1 I1 RFE Xh X1 X2 I2 R2

1 s R2 ' s

Figure 1-4 - Equivalent circuit for one phase with load

10/25/99

Page 4 of 25

a V/F controller on the ADMC401

Application Note: AN401-24

1.1.1 Change of Speed The change of speed on the induction machine can be changed in 3 different ways, which can be described towards the definition of the rotor speed: n = n0 n s = f * 60 ns p [1]

where, is the rotational field created from stator. n0 ns is the slip speed. p the number of polepairs. This equation indicates the three ways of changing the speed on the shaft. Changing the slip, the polepairs or the frequency. Slip-changes can only be done from either changing the rotor resistant (Phase-Wound Motors) or the input-voltage on stator. Polepair change; again a direct change of the motor-windings, where a coupling between different phases can be achieved. The last control-way is the frequency here the only limit is the source added to the motor. If the voltage applied to the machine can be changed from low voltage / frequency to high voltage /frequency an optimal speed-control is achievable. 1.1.2 The Torque Looking at Figure 1-4 the equivalent can be rearranged to express the current-flow in the load I'2. The equivalent will now be: RTH XTH X2 R2
I2 UTH

1 s R2 ' s

Figure 1-5 - Thvenin's equivalent for the motor

Where,

Z TH = (R1 + jX 1 ) ( jX h ) (RFE ) = RTH + jX TH

[2]

The current can now be expressed as: I '2 = RTH U TH + R' 2 / s + j (X TH + x ' 2 ) [3]

Now the torque can be expressed as:

10/25/99

Page 5 of 25

a V/F controller on the ADMC401 U TH R' 2 / s P 3 T= * = 2 2 0 (RTH + R ' 2 / s ) + (X TH + X ' 2 ) 0 Where, 0 P the angular speed. the Power.
2

Application Note: AN401-24

[4]

The torque for the machine can now be expressed from [4] - the torque as a function of the slip-change and gives us:
T

Tkip,

1 = n/n0

n n0

Figure 1-6 - Torque as a function of slip-change

The area 0 < n/n0 < 1 is called the area for standard operation, here the machine is functioning as a motor. When the ratio is moved to n/n0 > 1 the drive starts to work as a generator, the motor will in this area contribute with a back-torque and deliver energy back though the powerstage. In this application note the discussion is only concerning the motor-area. 1.1.3 Number-plate of the machine Looking at the number plate of the machine, many of the wanted information can be directly calculated on base of some simple parameters. First of all the Speed and Power of the machine which from [5] gives us the Torque [6] P= T= T *n 9.55 [5]

P * 9.55 1500 * 9.55 [6] = = 4.9 Nm n 2910 Here specific motor-parameters are added to calculate the torque. (Power[P] and Speed[n])

10/25/99

Page 6 of 25

a V/F controller on the ADMC401

Application Note: AN401-24

2 The Frequency Converter


Since the development of power-electronics a new way of controlling the motor-speed has been introduced. This topology is based on changing the frequency and / or the amplitude voltage on the motor-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:

T=

P * 9.55 * 3 * V * I * cos * 9.55 V = =k* 60 n f f * (1 s ) p

[7]

This equation implies that if the ration between the voltage and the frequency are kept constant the torque also stays constant. These terms are the ones used to implement the speedcontroller for the induction-machine. 2.1 The "standard" system - Hardware The frequency converter can be build up in many different ways, depending on the topology and flexibility of the system. One of the ways, which has become the most common is the way illustrated below.

Figure 2-1 - Principle of the controller

As it can be seen at Figure 2-1 the system includes 4 basic blocks which are: I. II. A rectifier used to generate DC from the 1 or 3 phase distribution net. The intermediate circuit - incorporates the DC-link control. Different control-aspects can be taken into account, such as PFC, DC-chopping or stabilization.

10/25/99

Page 7 of 25

a V/F controller on the ADMC401 III. IV.

Application Note: AN401-24

An Inverter used to reproduce three controlled waveforms. In this case the output from the inverter is three 120-degree phase-shifted sine-shaped voltages. Control-block - here all the necessary adjustment of the system are done. For the frequency converter 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 chips and can be bought as standalone devices with all the relevant electronics included. Such a device is chosen for this demo-application. The device is International Rectifiers PowIRtrain (IRPTXXX1) 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 phase voltages can be produced in many different ways. In this applications note the use of PWM controlled from 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 2-2 Sine, corresponding angle and PWM

1 2

For more information see http://www.irf.com/ For more information see applications note AN401-17 3 For more information see applications note AN401-3

10/25/99

Page 8 of 25

a V/F controller on the ADMC401

Application Note: AN401-24

At Figure 2-2 the voltage reference for one of the three phases with corresponding angle and PWM are illustrated. The three-phase references VrefA, VrefB and VrefC can be expressed as: VrefA = u r (t ) = U 1 sin( t ) 2 ) 3 2 VrefC = u t (t ) = U 1 sin( t ) 3 VrefB = u s (t ) = U 1 sin( t+ [8]

where the displacement of the voltages are as expressed 120. These three-phase references can be used directly in this simple three-phase generation as control-voltages for the frequency converter with sinusoidal 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 actual reference voltage, measured on the terminals to be 0.866. Motorvoltage = 3 Netvoltage = 0.866 * Netvoltage 2 [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 phase references expressed as:
VrefA = u r ( t ) = u s 1 ( t ) + u 0 ( t ) = U 1 sin( t ) + U 3 sin( 3 t ) 2 ) + U 3 sin( 3 t ) 3 2 VrefC = u t ( t ) = u s 3 ( t ) + u 0 ( t ) = U 1 sin( t ) + U 3 sin( 3 t ) 3 Where U u 0 = U 3 sin( 3 t ), U3 = 1 6 VrefB = u s ( t ) = u s 2 ( t ) + u 0 ( t ) = U 1 sin( t +

[10]

By utilizing just the unity scaled sine as generation platform for the third harmonic, this results in a maximum amplitude of 0.886*Netvoltage. By adjusting this value by 15.5% a Vc Vc 3 2 Vc 100% = 15.5 % 2 [11]

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

10/25/99

Page 9 of 25

a V/F controller on the ADMC401

Application Note: AN401-24

Figure 2-3 - Simulation of third-harmonic references

The same control angle as for the standard sine generation can be used with this method and the result can be seen on Figure 2-3. In Figure 2-4 the comparison of the reference voltage with the dedicated PWM are illustrated.

Figure 2-4 - Including third harmonic with corresponding angle and PWM

2.2.3 Space Vector Modulation SVM Since the introduction of reference frames4 there are for many applications huge advantages in utilising these frames for the complete control scheme. In the terms of PWM generation this technique (SVM) can directly be controlled within this frame (-). The three voltage references VrefA, VrefB and VrefC can be converted to the --frame as: V = V + jV = 2 (VrefA a 0 + VrefB a 1 + VrefC a 2 ) 3 a =e
j 2 3

[12]

where

[13]

For more information see applications note AN401-11

10/25/99

Page 10 of 25

a V/F controller on the ADMC401

Application Note: AN401-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 angular speed = 2 f f . As can be seen at Figure 2-5, the eight Re possible states of an inverter are represented as two null-vectors and six active-state vectors forming a hexagon. SVM now approximates the rotating reference vector in each switching cycle by switching between the two nearest active-state vectors and the null-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 every step. It may be anticipated that the maximum obtainable output voltage is increased with ordinary SVM up to 90% of the inverter capability. It is also a relatively easy task to improve this technique in order to reach full inverter capability.

V3=(0,1,0) V2=(1,1,0)

Vd/2 0 Vd/2 Vd A B C
V4=(0,1,1)

II

III
V0=(0,0,0)

I
V V7=(1,1,1) V1=(1,0,0)

IV V
V5=(0,0,1)

VI

V6=(1,0,1)

a)

b)

Figure 2-5: 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 2-6. The relations between the voltage-reference the PWM-sequence can be seen on Figure 2-6 (2)

Figure 2-6 - SVM with corresponding angle and PWM

10/25/99

Page 11 of 25

a V/F controller on the ADMC401

Application Note: AN401-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.
Per phase Motor Voltage

V/F ratio = 1 Volts rms/Hz Max Voltage

Acceleration time

Boost Voltage
Frequency of Motor Voltage (Hz)

Boost Speed

Max Speed

Figure 2-7 - Ramps examples

In Figure 2-7 the ramp / boost profile for this example is illustrated. Basically the ramps are defined by a max. / 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 called when needed. The mathematical description of the ramps are described below: Here, PWM_freq_acc ACC_time Number_of_Steps Count_Init Delta_Init : : : : : PWM_SYNC counter number of updates. Wanted acceleration time from minimum to maximum speed. How many steps are used in the ramp. Number of counts for correct acceleration time. Step-size.

are defined as, and result in: Count _ init = Acc _ Time * PWM _ freq _ acc Number _ of _ steps [14]

Delta _ init =

15 bit , 15 bit = 32768 Number _ of _ steps

[15]

These constants are defined in Ramps.h For the voltage profile the syntax is the same and the mathematical description are:

10/25/99

Page 12 of 25

a V/F controller on the ADMC401

Application Note: AN401-24

BOOST_FREQ MAX_FREQ Boost_voltage Maximum_voltage Boost_speed Maximum_speed

: : : : : :

BOOST frequency of the sine PWM Maximum frequency of the sine PWM. Voltage defined for boosting Maximum voltage to the motor At lower speed boost voltage is injected Maximum speed of the motor.

These constants are defined in v_f_ctrl.h

3
3.1

Software Example
Using the V/F routines and accessories

The V/F routines are developed as an easy-to-use library, which has to be linked to the users application. The idea with this library is for the user to easily get a working system up and running by utilising this standard procedure. This package has to be compiled and can then be linked to an application. The user simply has to include the header file v_f_ctrl.h if the Voltage/Frequency routine on the ADMC401 has to be used. Calling the CALCULATE_ ANGLE takes care of generating the control angle for the induction machine. In this Voltage/Frequency routine is it also possible to add in Boost conditions for the machine and thereby deliver start-torque for the application. Another routine in this library is the rampgenerator, witch can be included by the associated ramps.h file. Furthermore the procedure of compiling and linking will be shown in this example. In the example files the following section will demonstrate their application.
Table 1 Command overview

Operation Determine the control angle and boost Utilise SVM as PWM Reset the PowerIR-module Specify the a ramp profile

Usage Call CALCULATE_ANGLE; Call SVM_CALCULATION; Call PIO3_RESET_IR Call Profiles;

The three V/F-files can be added to the user library for usage in other dedicated programs. The V_F_CTRL.dsp, IR_RESET.dsp and the RAMPS.dsp contain the assembly code for the required subroutines. The related header-files, v_f_ctrl.h, ir_reset.h and ramps.h declares the functions for use in other modules.

10/25/99

Page 13 of 25

a V/F controller on the ADMC401 3.2 Utilizing the V/F library: An example

Application Note: AN401-24

This example demonstrates how a value is taken though the ADC1 and used as speed control set point for the motor. The duty-cycle patterns are generated by SVM (see AN401-17). In the file main.dsp (that may be downloaded with this application note) contains the initialisation and PWM interrupt service routines. To activate, build the executable file using the attached build.bat at your DOS prompt. This will create the object files and the main.exe example file. This file may be run on the Motion Control Debugger. In the following, a brief description of the additional code (put in evidence by bold characters) is given.
Start of code declaring start location in program memory
.MODULE/RAM/SEG=USER_PM1/ABS=0x60 { ... desiccation of module ... } Main_program;

Include application constants and V/F interface definitions The stdincl.h file is the compacted #include library path for all standard included files: #include <c:\adi\mcd401\TgtFiles\admc401.h>; {ADMC401 specific constants} #include <c:\adi\mcd401\TgtFiles\macro.h>; {Macro Definitions} #include <c:\adi\mcd401\TgtFiles\constant.h>; {Constants}

{********************************************************} { } { Include both ADMC401 and example specific constants } { } {********************************************************} #include <c:\adi\mcd401\TgtFiles\admc401.h>; #include #include #include #include #include <dac401.h>; <pwm401.h>; <ir_reset.h>; <adc401.h>; <v_f_ctrl.h>; {ADMC401 specific constants}

#include <refframe.h>; #include <svpwm.h>; #include <ramps.h>;

Subroutines defined in the Main-module.


{********************************************************} { } { Subroutines defined in this module } { } {********************************************************} .ENTRY PWMSYNC_ISR; .ENTRY PWMTRIP_ISR;

10/25/99

Page 14 of 25

a V/F controller on the ADMC401

Application Note: AN401-24

Initialisation and main loop code Note the initialisation of the POWER reset and RAMPS
{********************************************************} { } { Startup of Program } { } {********************************************************} STARTUP: CALL PIO3_RESET_IR; CALL Init_PWM; CALL Init_ramps; IFC = 0x80; AY0 = 0x200; AR = IMASK; AR = AR OR AY0; IMASK = AR; CALL Init_ADC; CALL Init_DAC; MAIN: NOP; NOP; JUMP MAIN; RTS; {Wait for interrupt to occur } {Clear any pending IRQ2 inter.} {Unmask IRQ2 interrupts. } {IRQ2 ints fully enabled here }

The next block in the main program is the PWM_ISR. In the interrupt service routine the blocks running in the module are called and the structure of the program is based. In this a speed command is read though ADC1 and the signal are used as speed set point for the motor. The Profile routine is used to define and check the input-speed upon a given ramp-structure the output from this routine is the variable Speed_profile. This variable can no be used to generate the wanted PWM sequence. First the control angle is found in Calculate_angle and then the Space Vector Modulated PWM is called in SVM_Calculation (for further information check AN401-17). The DAC functions are utilised for graphical debugging here it is chosen to plot the SVM-pattern, angle, speed and reference voltages in the alpha-beta-frame.
{********************************************************} { } { Interrupt Service Routine for PWM block. } { } {********************************************************} PWMSYNC_ISR: CALL Pause_DAC; CALL READ_ADC1; DM(Speed_command) = ar; CALL Profiles; CALL Calculate_Angle; CALL SVM_Calculation; CALL Resume_DAC; my0 = DM(VrefA); mx0 my0 my0 my0 = = = = 0x8; DM(Dutycycles_struct ); DM(Dutycycles_struct+1); DM(Dutycycles_struct+2); mr = mx0 * my0 (SS); mr = mx0 * my0 (SS); mr = mx0 * my0 (SS); Put_DAC(1, mr0); Put_DAC(2, mr0); Put_DAC(3, mr0); { { { { Required only when I1, M1 or L1 is used Read value on ADC1 Store in Speed_command } } } }

10/25/99

Page 15 of 25

a V/F controller on the ADMC401

Application Note: AN401-24

my0 = DM(theta); my0 = DM(Speed_Command); my0 = DM(Valphabeta_ref ); my0 = DM(Valphabeta_ref+1); call Update_DAC; RTI;

Put_DAC(4, my0); Put_DAC(5, my0); Put_DAC(6, my0); Put_DAC(7, my0);

The PWM-Trip routine is in this example used to check on the trip pin on the PowerIR-train5. This TRIPpin is hardwired to the PWM_TRIP_PIN on the ADMC401 device. When the PowerIRtrains pin goes low, in the case of over-current or 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 again 3. If it now has gone high call restart PWM ..
PWMTRIP_ISR: {********************************************************} { } { PWM_TRIP interrupt routine } { } {********************************************************} AR = DM(SYSSTAT); AR = TSTBIT 0 of AR; IF NE JUMP RESTART_PWM; CNTR = H#3FF; DO Wait0 UNTIL CE; Wait0: NOP; AR = DM(SYSSTAT); AR = TSTBIT 0 of AR; IF NE JUMP RESTART_PWM; DIS SEC_REG; RTI; {********************************************************} { } { After a shutdown - restart the PWM. } { } {********************************************************} RESTART_PWM: CNTR = H#3FF; DO Wait20 UNTIL CE; Wait20: NOP; IFC = 0X80; CALL INIT_PWM; AR = 0; DM(SPEED_PROFILE)=AR; .ENDMOD; { wait 80us } { clear IRQ2 interrupt } { clear SPEED_PROFILE to ensure SAFE start } { wait 80us } { check the PWMTRIP input again, if it has gone high } { restart the PWM block } { check the PWMTRIP input, if it has gone high { restart the PWM block } }

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

10/25/99

Page 16 of 25

a V/F controller on the ADMC401

Application Note: AN401-24

3.3 The IR_RESET interface and implementation. Including the header file ir_reset.h enables the possibilities of resetting the power module on startup. This routine can only be used along with the Connection board6 connected to one of the PowerIRtrain combined modules (IRPT-family). The ir_reset.dsp-file contains the functions for the actual resting code.
On the connector-board a hardwired connection though PIO3 are done to connect this pin to the resetpin on the IRPT-modules. This routine toggles PIO3 to reset the PowerIRtrain output stage. Furthermore the routine check up on the status of the PWM-Trip pin, BIT 0 in the SYSSTAT register. This resetting can be watched, as the red diode stop lighting when the fault has disappeared. Hereunder the resetting code is attached.
.MODULE/RAM/SEG=USER_PM1 { Functions for resetting IR board using P3 } { VERSION # 1.0 24/09/99 } IR_RESET_FUNC;

{*****************************************************} { } { Include both ADMCXXX and example specific constants } { } {*****************************************************} #include <stdincl.h>; #include <ir_reset.h>; #include <bit_ops.h>; {*****************************************************} { } { Subroutines defined in this module } { } {*****************************************************} .ENTRY PIO3_RESET_IR; {including all part specific files }

{*****************************************************} { } { Reset of IR-POWER module - using PIO3 } { } {*****************************************************} PIO3_RESET_IR: mem_set_bit(PIODIR, 3); mem_clear_bit(PIOINTEN, 3); rst: mem_set_bit(PIODATA, 3); { wait 10 usec } cntr = 150; do IR_delay until ce; nop; IR_delay: nop; mem_clear_bit(PIODATA, 3); { wait 100 usec } cntr = 1500; do IR_delay2 until ce; nop; IR_delay2: nop; { set PIO(3) low to enable the PowIRtrain } { set PIO(3) high to reset the PowIRtrain } { configure PIO(3) as output { disable PIO interrupts } }

For more information see ADMC connector Board rev. B

10/25/99

Page 17 of 25

a V/F controller on the ADMC401


wait_IR: ar = dm(SYSSTAT); af = tstbit 0 of ar; if eq jump rst; end: rts; .ENDMOD;

Application Note: AN401-24

{ wait for PowIRtrain fault output to be { deasserted i.e. high

} }

3.4 Using the ramp generator. As shortly described in section 2.2.4, ramps have to be generated to control the speed profiles of the motor-shaft. In this section the usage of the ramp generator are described. 3.4.1 The ramp generator Interface Including the header file Ramps.h in the application code as was already explained in the previous section may access this library.
The header file gives access to the ramp routines. These routines are mostly self-explaining, however the interface has to be defined for acceleration time and number of steps in the profile. These two values are used to initialise the counter and the step-size in the Ramps.dsp-file.
{ Functions } .EXTERNAL PROFILES; .EXTERNAL INIT_RAMPS; { Variables } .EXTERNAL speed_profile; .EXTERNAL Speed_Command; .CONST PWM_freq_acc .CONST Acc_Time .CONST Number_of_Steps .CONST Count_Init .CONST Delta_Init = 20000; = 20; = 64; { Desired PWM switching frequency [Hz] { Seconds from minimum to maximum speed { Number of steps in the ramp } } }

= (Acc_Time*PWM_freq_acc/Number_of_Steps); { Count number for timescaling = (32768/Number_of_Steps) ;

{ stepsize for the speedsteps }

3.4.2 Implementation of the ramp routines. In this section a more detailed description of the interface code included in the Ramps.dsp will be given. The section includes the initialization and the generation of the acceleration and deceleration of the speed.
This piece of code defines the module RAMPS_MOD as a relocatable module in memory. The ADMC401 specific constants are included along with utilized subroutines defined in other modules.
.MODULE/RAM/SEG=USER_PM1 { omissis } {********************************************************} { } { Constant definitions } { } {********************************************************} RAMPS_MOD;

10/25/99

Page 18 of 25

a V/F controller on the ADMC401


#include <c:\adi\mcd401\TgtFiles\admc401.h>; {********************************************************} { } { Subroutines defined in other modules } { } {********************************************************} #include <mathfun.h>; #include <ramps.h>; {********************************************************} { } { Subroutines defined in this module } { } {********************************************************} .ENTRY init_ramps; .ENTRY profiles; {********************************************************} { } { Local variables } { } {********************************************************} .VAR/DM/RAM/SEG=USER_DM1 speed_profile; .VAR/DM/RAM/SEG=USER_DM1 Speed_Command; .VAR/DM/RAM/SEG=USER_DM1 count; .VAR/DM/RAM/SEG=USER_DM1 delta; {********************************************************} { } { Global variables } { } {********************************************************} .GLOBAL speed_profile; .GLOBAL Speed_Command;

Application Note: AN401-24

Now the actual ramp code has to be analyzed. First of all a call of Init_Ramps makes sure that the startprofile is in a safe range.
Init_Ramps: ar = 0; dm(speed_command) = ar; dm(speed_profile) = ar; dm(count) = ar; dm(delta) = ar; RTS; { clearing all signals }

This next step is to use the defined clock-count and acceleration time to set up the ramps for the speed. Here the number of counts are checked and when the counter is expired (the chosen scaling factor reached) the profile routine are called. In Calc_profile the acceleration (ramp-specification) are loaded and the sign of the speed identified. If the speed change, compared with earlier value is negative jump to Negative_Speed_Change otherwise use Postive_Speed_Change. In the two Speed_Change sections the defined step size (Delta) compared with the speed difference and in case of equal results no further changes in speed are needed and the Speed_profile is updated with the Speed_Command signal. In the other case, where the signals are not equal to Delta, here Delta is either added or subtracted.

10/25/99

Page 19 of 25

a V/F controller on the ADMC401


Inputs : speed_command Destroys: ar, mr, mx0, my0, ay0 Updates : speed_profile delta count

Application Note: AN401-24

Description : Change the speed setpoint using a ramped profile. When a speed change is requested, produce a ramp which takes the chosen acceleration-time to get to next speed level. Destroys: ar, ax0, ay0 } Profiles: { if count is 0, then calculate the speed profile. Otherwise decrement count and quit } ar = dm(count); ar = pass ar; if eq jump calc_profile; ar = ar - 1; dm(count) = ar; jump End_Profile; Calc_Profile: ar = Count_Init; dm(count) = ar; ar = Delta_Init; dm(delta)=AR; { Calculated in the Ramps.h } { Calculated in the Ramps.h }

ar = dm(speed_command); ay0 = dm(speed_profile); ar = ar-ay0; if le jump negative_speed_change; Positive_Speed_Change: ar = ABS ar; ay0 = dm(delta); ar = ar - ay0; if le jump Done; ar = dm(speed_profile); ay0 = dm(delta); ar = ar + ay0; dm(speed_profile) = ar; jump End_Profile; Negative_Speed_Change: ar = ABS ar; ay0 = dm(delta); ar = ar - ay0; if le jump Done; ar = dm(speed_profile); ay0 = dm(delta); ar = ar - ay0; dm(speed_profile) = ar; jump End_Profile; Done: ar = dm(Speed_command); dm(speed_profile) = ar; End_Profile: RTS; .ENDMOD;

{ if speed_profile > Speedcommand jump { negative_speed_change

} }

{ if speed_profile = Speedcommand jump Done} { speed_profile + delta }

{ if speed_profile = Speedcommand jump Done} { speed_profile - delta }

{ speed_profile = Speed_command }

10/25/99

Page 20 of 25

a V/F controller on the ADMC401

Application Note: AN401-24

3.5 The V_F_PROFILES module This module is generated to combine the angle and PWM generation of the V/F-converter. In the following sections the angle generation and SVM definition is defined and utilized.
This piece of code defines the module V_F_PROFILES as a relocatable module in memory. The ADMC401 specific constants are included along with utilized subroutines defined in other modules. The definition of the variables are here done globally which means that all the structures and variables can be used in other modules such as the MAIN.DSP for plotting.
.MODULE/RAM/SEG=USER_PM1 V_F_PROFILES;

{ VERSION # 1.0 24/09/99 This file includes the following functions: (1) ANGLE GENERATOR - FOR V/F-CONTROL (2) SPACE VECTOR GENERATOR } {********************************************************} { } { Include both ADMC401 and example specific constants } { } {********************************************************} #include <c:\adi\mcd401\TgtFiles\admc401.h>; #include <c:\adi\mcd401\TgtFiles\constants.h>; #include <refframe.h>; #include <svpwm.h>; #include <v_f_ctrl.h>; #include <Ramps.h>; {********************************************************} { } { Global variables } { } {********************************************************} .VAR/RAM/DM/SEG=USER_DM1 .VAR/DM/RAM/SEG=USER_DM1 THETA; {Control Angle} Voltage_Profile; Vdq_ref[2]; { rotor ref.frame Valphabeta_ref[2]; { alphabeta frame OnTime_struct[1*4]; Dutycycles_struct[1*3]; } } {PWM constants } {ADMC401 specific constants} {ADMC401 specific constants}

.VAR/DM/RAM/SEG=USER_DM1 .VAR/DM/RAM/CIRC/SEG=USER_DM1 .VAR/RAM/DM/SEG=USER_DM1 .VAR/RAM/DM/SEG=USER_DM1

{********************************************************} { } { Global variable definitions } { } {********************************************************} .GLOBAL THETA; .GLOBAL Voltage_Profile; .GLOBAL .GLOBAL .GLOBAL .GLOBAL Vdq_ref; Valphabeta_ref; OnTime_struct; Dutycycles_struct;

{********************************************************} { } { Initialization of modules } { } {********************************************************}

10/25/99

Page 21 of 25

a V/F controller on the ADMC401

Application Note: AN401-24

.INIT THETA : 0; .INIT .INIT .INIT .INIT Vdq_ref: Valphabeta_ref: OnTime_struct: Dutycycles_struct: 0x0000, 0x0000; 0x0000, 0x0000; 0x0000, 0x0000, 0x0000, 0x0000; 0x0000, 0x0000, 0x0000;

{*****************************************************} { } { Subroutines defined in this module } { } {*****************************************************} .ENTRY .ENTRY CALCULATE_ANGLE; SVM_CALCULATION; { Standard V/F generating using the value on ADC1 { to generate angle and frequency { Calculate dutycycle and ontimes for the PWM} } }

3.5.1 Using the CALCULATE_ANGLE The Calculate_Angle routine takes care of generating the control-angle for the three-phase system. This angle is used in all of the vector-transformations and is as seen the hart of the V/F-converter. Without this angle the transformations are not working and no updated signals are fed to the PWM-block.
This piece of code is mainly self-documenting. The scaling signal is taken from ADC1 and is used as counter-number for the angle-frequency (Speed).

3.5.1.1 Boost
The other addition in the Calculate_Angle routine is adding boost to maintain current-flow (Torque) at low speed. If the speed is less than the chosen minimum-speed (in this case 10%) Specified in the v_f_ctrl.h-file a boost voltage is added to the magnetization to maintain speed in this area. For more detailed information see 2.2.4.
CALCULATE_ANGLE: {***********************************************************************} { } { Angle generation for the v_f_controller } { The value read from ADC1 was stored in DM(Speed_profile)this is now } { used to calculate the angle. Overflow handled automatically as } { angle defined in -pi -> +pi. } { } {***********************************************************************} 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; {***********************************************************************} { } { Utilize the Vector transformation calculate the alpha and beta } { frames on base of the generated angle Thata. } { } {***********************************************************************} { } { If speed_input le minimum_speed current is boosted with chosen } { value - in this case Boost_voltage } { } {***********************************************************************}

10/25/99

Page 22 of 25

a V/F controller on the ADMC401

Application Note: AN401-24

Boost_Frequency: ar = dm(Speed_Profile); ar = abs ar; ay0 = Boost_speed; ar = ar - ay0; if ge jump Over_Boost_Frequency; my0 = Boost_voltage; dm(voltage_profile) = my0; DM(Vdq_ref)= my0; ar = pass 0; DM(Vdq_ref+1)= ar; JUMP Out_of_Voltage_setting; Over_Boost_Frequency: ar = dm(Speed_Profile); ar = abs ar; } ay0 = Maximum_speed; ar = ar - ay0; if ge jump Max_voltage; my0 = dm(Speed_Profile); dm(voltage_profile) = my0; DM(Vdq_ref)= my0; 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; ar = pass 0; DM(Vdq_ref+1)= ar; Out_of_Voltage_setting: RTS; { Set constant Vdq reference (Voltage_profile,0) } { Check if speed is in the minimum speed range { Set constant Vdq reference (Voltage_profile,0) } { Check if speed is in the minimum speed range} { if speed_profile =>Boost_speed jump { Over_Boost_Frequency } }

{ if speed_profile = Speedcommand jump Boost_added { Load Speed profile signal { Set constant Vdq reference (Voltage_profile,0)

} } }

3.5.2 Using the SVM_CALCULATION This small routine is done to do the generation of the three-phase SVPWM. The only needs for the routine is the angle and the alpha-beta reference voltages stored in their variables.
The angle is used in the vector-transformations and the SVM generation is calculated on base of these references. Last the dutycycles of the PWM-channels are updated and send to the PowerIRtrain.
SVM_CALCULATION: {***********************************************************************} { } { Set up SVM-module for transformation and SVM-generated PWM } { } {***********************************************************************} mr1 = dm(Theta); { control angle } Set_DAG_registers_for_transformations; Forward_Park_angle(Vdq_ref,Valphabeta_ref,mr1); { Generate Vref in a-b frame

10/25/99

Page 23 of 25

a V/F controller on the ADMC401

Application Note: AN401-24

SVM_Calc_Ontimes(Valphabeta_ref, OnTime_struct); { use SVPWM routines SVM_Calc_Dutycycles(OnTime_struct, Dutycycles_struct); SVM_Update_DutyCycles(Dutycycles_struct); RTS; .ENDMOD;

10/25/99

Page 24 of 25

a V/F controller on the ADMC401

Application Note: AN401-24

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

10/25/99

Page 25 of 25

Você também pode gostar