Beruflich Dokumente
Kultur Dokumente
AN331-24
Page 1 of 24
AN331-24
Table of Contents
SUMMARY...................................................................................................................... 3 1 THE INDUCTION MACHINE .................................................................................... 3
1.1 Theory / Construction ....................................................................................................................................3 1.1.1 Change of Speed ......................................................................................................................................5 1.1.2 The Torque...............................................................................................................................................5 1.1.3 Number-plate of the machine ...............................................................................................................6
2
2.1
2.2 The control-functions build up in the ADMC331. .......................................................................................8 2.2.1 Basics - Standard .....................................................................................................................................8 2.2.2 Third-harmonic Injected ..........................................................................................................................9 2.2.3 Space Vector Modulation SVM..........................................................................................................10 2.2.4 Ramps / Boost........................................................................................................................................12
3
3.1 3.2 3.3 3.4 3.5 3.6 3.7
4 SOFTWARE EXAMPLE: CONSTANT VOLT/HERTZ OPERATION - WITH SVM AND RAMPS ................................................................................................................ 20
4.1 4.2 The main program: Main.dsp .....................................................................................................................20 The main include file: main.h ......................................................................................................................23
REFERENCE.......................................................................................................... 24
Page 2 of 24
AN331-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.1
Theory / Construction
The standard motor is designed with a short-circuiting rotor (on Figure 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 - 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 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 [].
Page 3 of 24
AN331-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. This interaction are described though RFE - iron core and hysteresis losses Xh - magnetic losses.
R1 I1
X1
X2
R2/s
RFE
Xh
Figure 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 4), where s = the slip.
R1 I1
X1
X2 I2
R2
RFE
Xh
1 s R2 ' s
Page 4 of 24
AN331-24
n = n0 ns =
where, n0 ns p is the rotational field created from stator. is the slip speed. the number of polepairs.
f * 60 ns p
[1]
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.
RTH
XTH
X2 I2
R2
UTH
1 s R2 ' s
Z TH = (R 1 + jX1 ) ( jX h ) (R FE ) = R TH + jX TH
The current can now be expressed as:
[2]
I'2 =
R TH
[3]
Page 5 of 24
a V/F Controller on the ADMC331 Now the torque can be expressed as:
AN331-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, nkip
1 = n/n0
n n0
Figure 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.
T=
[6]
Here specific motor-parameters are added to calculate the torque. (Power[P] and Speed[n])
Page 6 of 24
AN331-24
T=
[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 speed-controller for the inductionmachine.
2.1
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 7 - Principle of the controller As it can be seen at Figure 7 the system includes 4 basic blocks which are: I. II. III. 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. 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. Page 7 of 24
AN331-24
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
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 ADMC331 is utilized. In this section the theory behind basics, third-harmonic and Space-Vector-Modulated2 references are discussed.
Figure 8 Sine, corresponding angle and PWM At Figure 8 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:
1 2 3
For more information see http://www.irf.com/ For more information see applications note AN331-17 For more information see applications note AN331-3 Page 8 of 24
AN331-24
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.
Motorvoltage =
[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 s1 (t) + u 0 (t) = U 1 sin( t) + U 3 sin(3 t ) 2 ) + U 3 sin(3 t ) 3 2 ) + U 3 sin(3 t ) VrefC = u t (t) = u s3 (t) + u 0 (t) = U 1 sin( t 3 Where VrefB = u s (t) = u s2 (t) + u 0 (t) = U 1 sin( t + u o = U 3 sin(3 t ), U3 = U1 6
[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 better utilization of the DC-bus voltage is achieved, meaning the efficiency from the distribution-net to the Power Inverter.
Vc Vc Vc 100% = 15.5 % 3 2 2
[11]
Page 9 of 24
AN331-24
Figure 9 - 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 9. In Figure 10 the comparison of the reference voltage with the dedicated PWM are illustrated.
[12]
[13]
AN331-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 11, the eight possible states of an inverter are represented Re 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)
Vd/2 0 Vd/2 Vd A B C
V4=(0,1,1)
II
V2=(1,1,0)
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 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 relations between the voltage-reference the PWM-sequence can be seen on Figure 12 (2)
Page 11 of 24
AN331-24
Acceleration time
Boost Voltage
Max Speed
Frequency of Motor Voltage (Hz)
Boost Speed
Cut Speed
Figure 13 - Ramps examples In Figure 13 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 ADMC331 these ramps / profiles are coded and can be called when needed. profiles are coded and can be called when needed. The mathematical description of the ramps are described below: Here, PWM_freq : Number_of_Steps : Count_Init : Delta_Init : are defined as, and result in: PWM update frequency. How many steps are used in the ramp. Number of counts for correct acceleration time. Step-size.
Count_Div =
PWM_freq Number_of_steps
[14]
Delta_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 period CUT_FREQ : Maximum frequency of the end slope BOOST_FREQ : BOOST frequency of the period MIN_FREQ : MIN frequency of the period and the mathematical description are: Analog Devices Inc., January 2000 Page 12 of 24
AN331-24
PWMCycles_period =
PWM_freq , MAX_FREQ
Increment =
1 PWMCycles_period
[16]
Boost Voltage =
15 Bit VOLT_SCALING
[17]
Boost_speed =
[18]
Boost_speed =
[19]
Boost_speed =
[20]
All these general constants are defined in main.h and together with the associated macros (further description 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 is done in the "main.h" and the "v_f_ctrl.dsp" files.
Page 13 of 24
AN331-24
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 this application 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 Configuration of the IR_Reset Configuration of the Ramps Set the minimum speed Set the acceleration of the speed ramp Calculate the projecting voltage and angle Update the SVM and calculate duty-cycle Usage IR_reset_PIO3; Ramps_Init_Speed_profile; Set_Minimum_Speed; Ramps_Calculate_Speed_Profile(EXP,NOM) V_F_ctrl_Calculate_Angle_volt 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 are declared in a dedicated section of the main include-file "main.h". If a routine require internal configuration 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 relevant segments of code that are found in any of the files described in Table 1.
Page 14 of 24
AN331-24
3.2
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 though PIO3. 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); Clear_Bit_DM(PIOINTEN0, 3); rst: Set_Bit_DM(PIODATA0, 3); { wait 10 usec } cntr = 150; do IR_delay until ce; nop; IR_delay: nop; Clear_Bit_DM(PIODATA0, 3); { wait 100 usec } cntr = 1500; do IR_delay2 until ce; nop; IR_delay2: nop; { set PIO(3) high to reset the PowIRtrain } { configure PIO(3) as output { disable PIO interrupt 3 } }
} }
3.3
The macro that configures the initialization of the Ramp module is defined to clear the input to the routine. The Ramps_Init_Speed_profile macro 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;
Page 15 of 24
AN331-24
3.4
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_Speed macro calls the Set_Minimum_Speed_ routine and returns to subroutine.
Set_Minimum_Speed_: ar = abs ar; ay0 = Minimum_speed; ar = ar - ay0; if ge jump Over_Min_Speed; my0 = Minimum_speed; dm(Speed_command) = my0; Over_Min_Speed: RTS; { Check if speed is in the minimum speed range }
3.5
The Ramps_Calculate_Speed_Profile(EXP,NOM) macro controls the acceleration ramps input to the ramps_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.4 and illustrated in the section below. These constants are the number of steps in the ramp, the count number 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 * ***************************************************************************************}
be
done in the
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_command value. Is the value less than the last calculated speed_profile the value is decreased. If the value of speed_command is bigger than last calculation the speed_profile are increased.
Ramps_Speed_Profiles_: ar = dm(count); ar = pass ar; 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; dm(delta)=AR; ar = dm(speed_command); ay0 = dm(speed_profile); { if count is 0,then calculate the speed profile} { Other wise decrement count and quit. }
Page 16 of 24
AN331-24
} }
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;
} }
} }
{ speed_profile = Speed_command
Page 17 of 24
AN331-24
3.6
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 discussed in section 2.2.4 these constants defines the profile illustrated on Figure 13. The constants are as can be seen 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.
= = = = = =
(PWM_freq/MAX_FREQ); { Number of pwm cycles pr period 0x10000 / PWMCycles_period; { Angle increment at MAX_FREQ 0x7FFF / VOLT_SCALING; { XX % Of maximum voltage 0x7FFF / MAX_FREQ * BOOST_FREQ; { In this case 30 Hz MAX_FREQ / MAX_FREQ *0x7FFF; { The Maximum_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_profile returned from the Ramps_Calculate_Speed_Profile macro.
V_F_ctrl_CALCULATE_ANGLE_VOLT_: mr = 0; mr1 = dm(Theta); mx0 = dm(Speed_Profile); my0 = Increment; mr = mr + mx0*my0 (SS); dm(Theta) = mr1; { Clear mr { Preload Theta { Load Speed profile signal { Compute new angle & store } } } }
Second section of the routine checks the Speed_profile and depending on the selected speed_profile see Figure 13 the voltage is projected. Due to the SVM5, 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 scaling of 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 has to be twice the size. For that reason a gain factor V_F_SCALE ("main.h") is introduced. This factor controls the scaling of the V/F (In the code an extra scaling of 8 is done to overcome higher frequencies).
AN331-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; ar = pass 0; DM(Vdq_ref+1)= ar; { Set constant Vdq reference (Voltage_profile,0)
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); my0 = V_F_SCALE; mr = ar*my0 (SS); sr=LSHIFT mr1 by 3 (LO); my0 = sr0; 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) } { { { { Load Speed profile signal V_F_SCALE Compute new angle & store shift 3 to multiply v_f ratio with 8
} } } } }
Page 19 of 24
AN331-24
3.7
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 of the SVM6. 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.1
The file main.dsp contains the initialisation and PWM Sync and Trip interrupt service routines. To activate, build the executable file using the attached build.bat either within your DOS prompt or clicking on it from Windows Explorer. 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 this is given.
Start of code declaring start location in program memory
.MODULE/RAM/SEG=USER_PM1/ABS=0x30 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.
AN331-24
{*************************************************************************************** * Include General System Parameters and Libraries * ***************************************************************************************} #include <main.h>; #include <adc331.h>; #include <autocal.h>; #include <dac331.h>; #include <pwm331.h>; #include <refframe.h>; #include <svpwm.h>; #include <ir_reset.h>; #include <ramps.h>; #include <v_f_ctrl.h>; { Application Specific Module } { Application Specific Module } { 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, AutoCalibration 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; PWM_Init(PWMSYNC_ISR, PWMTRIP_ISR); ADC_Init; AUTOCAL_Init; DAC_Init; Ramps_Init_Speed_profile; IFC = 0x80; ay0 = 0x200; ar = IMASK; ar = ar or ay0; IMASK = ar; { Clear any pending IRQ2 inter. { unmask irq2 interrupts. } } { Reset PowIRTrain Module }
The first thing that is done in the PWMSYNC_IRS is the Autocalibration. Then 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.
Page 21 of 24
AN331-24
{********************************************************************************************} { PWM Interrupt Service Routine } {********************************************************************************************} PWMSYNC_ISR: AutoCal_Calibrate; DAC_Pause; ADC_Read(ADC1); DM(Speed_command) = ar;
{ Required only when I1, M1 or L1 is used { Store in Speed_command { Set the minimum speed { 20 sec. see ramps.h
} } } }
Set_Minimum_Speed; ramps_Calculate_Speed_Profile(0x5,0x4fff); V_F_ctrl_Calculate_Angle_volt; V_F_ctrl_SVM_Calculation; DAC_resume; my0 mx0 my0 my0 my0 = = = = = DM(VrefA); 0x8; DM(Dutycycles_struct ); DM(Dutycycles_struct+1); DM(Dutycycles_struct+2);
Dac_Put(1, mr0); Dac_Put(2, mr0); Dac_Put(3, mr0); Dac_Put(4, my0); Dac_Put(5, my0); Dac_Put(6, my0); Dac_Put(7, my0);
my0 = DM(theta); my0 = DM(Speed_Profile); my0 = DM(Valphabeta_ref ); my0 = DM(Valphabeta_ref+1); DAC_Update; RTI;
The PWM-Trip routine is in this example used to check on the trip pin on the PowerIR-train7. This TRIP-pin is hardwired to the PWM_TRIP_PIN on the ADMC331 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: Test_Bit_DM(SYSSTAT,0); If_Set_Jump(RESTART_PWM); CNTR = H#3FF ; DO Wait0 UNTIL CE; Wait0: NOP; Test_Bit_DM(SYSSTAT,0); If_Set_Jump(RESTART_PWM); DIS SEC_REG; RTI; {***************************************************************************************} { After a shutdown - restart the PWM. } {***************************************************************************************} RESTART_PWM: CNTR = H#3FF; { check the PWMTRIP input... { if it has gone high, restart the PWM block } }
{ wait 80us }
{ check the PWMTRIP input again... { if it has gone high, restart the PWM block
} }
AN331-24
} }
4.2
This file contains the definitions of ADMC331 constants, general-purpose macros and the configuration parameters 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 ADMC331 Evaluation Kit) is expressed in kHz. Then ADMC331 specific constants, ROM-Utilities and general-purpose macros are included. Refer to the ADMC331 documentation for details on the ROM-Utilities.
{*************************************************************************************** * General System Parameters and Constants * ***************************************************************************************} .CONST Cry_clock = 12960; {Crystal clock frequency [kHz] }
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 ADMC331 } .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 ADMC331 } .CONST V_F_SCALE = 0x1000; { To get 1 in scaling factor 60Hz/60Hz { calculation (Gain of 8 in code) { Voltage scaling factor (divisor of V) } } }
.CONST VOLT_SCALING .CONST .CONST .CONST .CONST .CONST Maximum_voltage MAX_FREQ CUT_FREQ BOOST_FREQ MIN_FREQ
{ { { {
Maximum frequency of the sine pwm Maximum frequency of the end slope BOOST frequency of the sine pwm MIN frequency of the sine pwm
} } } }
{********************************************************************************************}
Page 23 of 24
AN331-24
5 Reference
[1] A Tutorial in AC Induction and Permanent Magnet Synchronous Motors. Analog Devices Inc. '94.
Page 24 of 24