CORDIC and MDU for Constant V/F control of Induction Motor - description

Application Note, V1.0, Aug. 2008
AP08086
XC88x/XC878 Series
CORDIC and MDU for Constant V/F Control
of Induction Motor
Microcontrollers
Edition 2008-08-27
Published by
Infineon Technologies AG
81726 München, Germany
© Infineon Technologies AG 2008.
All Rights Reserved.
LEGAL DISCLAIMER
THE INFORMATION GIVEN IN THIS APPLICATION NOTE IS GIVEN AS A HINT FOR THE
IMPLEMENTATION OF THE INFINEON TECHNOLOGIES COMPONENT ONLY AND SHALL NOT BE
REGARDED AS ANY DESCRIPTION OR WARRANTY OF A CERTAIN FUNCTIONALITY, CONDITION OR
QUALITY OF THE INFINEON TECHNOLOGIES COMPONENT. THE RECIPIENT OF THIS APPLICATION
NOTE MUST VERIFY ANY FUNCTION DESCRIBED HEREIN IN THE REAL APPLICATION. INFINEON
TECHNOLOGIES HEREBY DISCLAIMS ANY AND ALL WARRANTIES AND LIABILITIES OF ANY KIND
(INCLUDING WITHOUT LIMITATION WARRANTIES OF NON-INFRINGEMENT OF INTELLECTUAL
PROPERTY RIGHTS OF ANY THIRD PARTY) WITH RESPECT TO ANY AND ALL INFORMATION GIVEN
IN THIS APPLICATION NOTE.
Information
For further information on technology, delivery terms and conditions and prices please contact your nearest
Infineon Technologies Office (www.infineon.com).
Warnings
Due to technical requirements components may contain dangerous substances. For information on the types
in question please contact your nearest Infineon Technologies Office.
Infineon Technologies Components may be used in life-support devices or systems only with the express
written approval of Infineon Technologies, if a failure of such components can reasonably be expected to
cause the failure of that life-support device or system, or to affect the safety or effectiveness of that device or
system. Life support devices or systems are intended to be implanted in the human body, or to support
and/or maintain and sustain and/or protect human life. If they fail, it is reasonable to assume that the health
of the user or other persons may be endangered.
AP08086
Constant V/F Control of Induction Motor
AP08086
Revision History:
2008-08
Previous Version:
none
Page
V1.0
Subjects (major changes since last revision)
We Listen to Your Comments
Any information within this document that you feel is wrong, unclear or missing at all?
Your feedback will help us to continuously improve the quality of this document.
Please send your proposal (including a reference to this document) to:
[email protected]
Application Note
3
V1.0, 2008-08
AP08086
Constant V/F Control of Induction Motor
Table of Contents
Page
1
1.1
1.2
1.2.1
Introduction ...................................................................................................................................5
Overview .........................................................................................................................................5
Motor Theory ...................................................................................................................................5
Principle of Operation......................................................................................................................5
2
2.1
2.2
2.3
2.3.1
2.3.2
2.3.3
Speed control of Induction motor ...............................................................................................6
Speed Control .................................................................................................................................6
Principle of Constant V/F Control....................................................................................................7
Principle of SVPWM Technique ......................................................................................................8
Three Phase Inverter ......................................................................................................................8
Six Step Mode .................................................................................................................................9
Space Vector Pulse Width Modulation..........................................................................................10
3
3.1
3.2
3.2.1
3.2.2
3.2.3
3.2.3.1
3.2.4
3.2.5
3.3
Software Implementation ...........................................................................................................13
Control System Overview..............................................................................................................13
CCU6 Timer T12 Period Match Interrupt ......................................................................................14
T12 Period Match ISR Disabled....................................................................................................14
Angle Calculation ..........................................................................................................................15
Space Vector Modulation ..............................................................................................................15
Calculation of PWM duty cycle for SVM .......................................................................................15
Update of CAPCOM6 Registers....................................................................................................17
Current Measurement ...................................................................................................................17
Timer T2 Overflow Interrupt ..........................................................................................................19
Appendix A
Application Note
Code for Switching Time Calculation...............................................................................21
4
V1.0, 2008-08
AP08086
Constant V/F Control of Induction Motor
Introduction
1
Introduction
1.1
Overview
This application note describes the implementation of a constant V/F control algorithm for control of an
Induction motor using space vector modulation (SVPWM). Constant V/F control is a popular algorithm for
open loop speed control of AC induction motors. This method is most suitable for applications without
position control requirements or the need for high precision speed control. Examples of these applications
include air conditioning, fans and blowers etc.
In this application note, the principles of constant V/F control, SVPWM and the software implementation for
the XC88x/XC878 microcontrollers are discussed. Also the advantages of the microcontroller peripherals:
CAPCOM6E (Capture and Compare Unit for modulation and PWM generation) and the fast 10-bit ADC
(Analog-to-Digital Converter), which are specifically designed for the motor control applications are
discussed.
This motor control software makes use of the advantages of the XC88x/XC878 peripherals, like the
implementation of SVPWM using the CORDIC and MDU coprocessor units. The software for Induction
motor control is written both in C and assembly, specifically the main algorithms (e.g. V/F control, SVPWM
and current calculation subroutines) are written in assembly to reduce the execution time.
1.2
Motor Theory
AC Induction motors (ACIM) are widely used in industrial and residential motor applications due to their
simple construction and durability. These motors have no brushes to wear out or magnets that add to the
cost.
An induction motor has basically two parts, the Stator and the Rotor. The stator is made up of a number of
stampings with slots to carry three phase windings. It is wound for a definite number of poles. The windings
o
are geometrically spaced 120 apart. Two types of rotors are used in induction motors – Squirrel cage rotor
and Wound rotor. The most common type of rotor is the squirrel cage rotor. The rotor consists of a stack of
steel laminations with evenly spaced conductor bars around the circumference. The conductor bars are
mechanically and electrically connected with end rings.
1.2.1
Principle of Operation
When a three phase AC voltage is applied to stator windings of an induction motor, a rotating magnetic field
is produced. The rotating magnetic field travels at an angular speed equal to its stator frequency. It is
assumed that the rotor is at standstill. The rotating magnetic field in the stator induces electromagnetic
forces in the rotor windings. As the rotor windings are short circuited, current circulates in them, producing a
reaction. As known from Lenz’s law, the reaction is to counter the source of the rotor current, i.e., the
induced emf in the rotor creates a rotating magnetic field in the rotor. The induced emf will be countered if
the difference in the speed of the rotating magnetic fields from the stator and the rotor becomes zero. When
the differential speed between the rotor and magnetic field in the stator becomes zero, there is zero emf and
hence zero rotor current resulting in zero torque production in the motor. This is called the synchronous
speed of the machine. Now, depending on the shaft load, the rotor will settle down to a speed, always less
than the speed of rotating magnetic field and torque will be produced,.The speed differential is known as the
slip speed.
Synchronous speed is given as
ωs = 2πfs [rad/sec]
where fs - supply frequency
(1.1)
Synchronous speed or speed of the stator magnetic field in rpm, given as
Ns =
Application Note
120 fs
[RPM] where Pp – Number of poles
Pp
5
(1.2)
V1.0, 2008-08
AP08086
Constant V/F Control of Induction Motor
Speed control of Induction motor
2
Speed control of Induction motor
The induction motor always runs at less than its synchronous speed and by controlling the synchronous
speed, the actual rotor speed can be controlled. The relationship between the synchronous speed, stator
poles and the supply frequency is given in equation (1.2).
2.1
Speed Control
For inverter driven induction motors, the speed can be controlled by changing the supply frequency. In order
to maintain the constant air gap flux (and not allow it to saturate), the magnitude of the applied voltage needs
to be varied in accordance with the frequency variation.
The rms value of air gap induced emf in an induction motor is given by
1
kwΦm ωs T [v]
2
Eemf =
(2.1)
Eemf = 4.44kwΦmfsT [v]
Where kw
(2.2)
- Stator winding factor
Φm
- Peak air gap flux
fs
- Supply frequency [Hz] (ωs =2π fs )
T
- Number of turn per phase in the stator
Neglecting the stator impedance Rs+jXls, the induced emf approximately equals the supply phase voltage.
Hence,
Vph ≈ Eemf
(2.3)
The flux is then written as
Φm =
Vph
Kb fs
(2.4)
Where kb = 4.44kwT
Kb is constant, so flux is approximately proportional to the ratio between the supply voltage and frequency.
This is represented as
Φm α
Vph
α Kvf
fs
(2.5)
Where Kvf is the ratio between Vph and fs
From equation (2.4), it is seen that, to maintain the flux constant, Kvf has to be maintained constant.
Therefore, whenever stator frequency is changed, the stator input voltage has to be changed accordingly so
as to keep Kvf constant.
A number of control strategies have been formulated, depending on how the voltage to frequency ratio is
maintained:
a. Constant V/F control
b. Constant slip-speed control
c.
Constant air gap flux control
d. Vector control
Application Note
6
V1.0, 2008-08
AP08086
Constant V/F Control of Induction Motor
Speed control of Induction motor
2.2
Principle of Constant V/F Control
If the effect of stator impendence, Rs+jXls, is not neglected, than relation between applied voltage and
induced emf is given below
Vph = Eemf + Is(Rs+jXls)
Where Is
(2.6)
- Fundamental stator phase current, A
Rs
- Stator resistance per phase, Ω
Xls
- Stator leakage reactance per phase,Ω
Induced emf is give as
Eemf = j(LmIm)ωs = j λmωs
Where Lm
(2.7)
- Magnetizing inductance per phase, H
Im
- Magnetizing current per phase, A
ωs
- Supply angular velocity, rad/sec
λm
- Mutual air gap flux linkages, V-s
Substituting equation (2.6) in equation (2.5), Phase voltage is derived as follow
Vph = j λmωs + Is(Rs+jXls) = IsRs + j (λmωs + IsXls)
Vph = IsRs + jωs (λm + Is Lls)
(2.8)
Where Xls = Llsωs
Lls
- Stator leakage inductance per phase, H
Hence the magnitude of phase voltage is given as
2
2
2
|Vph| = √ ((IsRs) + ωs (λm + Is Lls) )
(2.9)
From equation (2.8), it is clear that V/F ratio needs to be adjusted based on, the supply frequency, the air
gap flux magnitude, the stator impedance and the magnitude of the stator current. Such a complex
implementation is not desirable for low performance applications, such as fans and pumps; therefore it is
usual to have a preprogrammed voltage to frequency relationship as shown in Figure 1. Also an offset
voltage should be added at low stator frequency to overcome the stator resistance drop.
The relationship between the applied voltage and frequency is written as
Vph = Voffset + Kvffs
(2.10)
Where Voffset = IsRs
Application Note
7
V1.0, 2008-08
AP08086
Constant V/F Control of Induction Motor
Speed control of Induction motor
Voltage [V]
Vrated
Voffset
Frequency [Hz]
Figure 1
Voltage and Frequency profile for Constant V/F control
2.3
Principle of SVPWM Technique
frated
Pulse with modulation can be used to create a sinusoidal voltage by adjusting the duty cycle. The
inductance of the motor will filter the PWM into a smooth signal. There are different ways to generate
sinusoidal voltages with a three phase inverter. Space vector pulse with modulation is one of the popular
methods to produce three phase sinusoidal voltages because it generates higher voltages with lower total
harmonic distortion than sinusoidal PWM techniques.
2.3.1
Three Phase Inverter
An inverter is an electronic circuit for converting direct current to alternating current. The structure of a
typical three phase voltage source power inverter is shown in Figure 2. Va, Vb and Vc are the phase voltages
applied to the windings of the motor. Q1 through Q6 are the six MOSFETs which are controlled by the input
+
+
+
PWM signals (A , A , B , B , C and C ), that shape the input voltages supplied to the motor terminals.
Figure 2
Three Phase Voltage Source Inverter
Application Note
8
V1.0, 2008-08
AP08086
Constant V/F Control of Induction Motor
Speed control of Induction motor
+
-
Note that whenever the MOSFET A is switched on, MOSFET A must be switched off and visa versa, to
prevent damaging shoot-through current.
This makes it easy to adopt a simple notation for describing the state of the inverter. For example, the state
+
when transistor A , B and C are on can be represented with the notation (100). The state where transistors
+
+
A , B and C are on is denoted bye (011)
2.3.2
Six Step Mode
In a three phase inverter, the three outputs can supply voltage at the motor terminals in any one of six active
states “100”, “110”, “010”, “011”, “001” and “101”. In addition, two inactive states that produce no voltage at
the motor terminals are “000” and “111”.
Six resultant nonzero voltage vectors generated from six switch states respectively is illustrated in Figure 3.
o
They are of the same magnitude and each shifted by an angle of 60 in space. Two zero vectors (inactive
states) are at the origin and supply zero voltage to a motor. These eight vectors are called the basic space
vectors and are denoted by U0, U1, U2, U3, U4, U5, O000 and O111.
(0,1,0)
U2
(1,1,0)
U1
Sector
1
Sector
2
(0,1,1)
U3
Sector
0
Sector
3
Sector
5
(1,0,0)
U0
Sector
4
U4
(0,0,1)
Figure 3
U5
(1,0,1)
Space Vector Pulse Width Modulation – Sector
Consider the following sequence of states:
(100, 110, 010, 011, 001, 101)
Running the inverter through this switching sequence will produce the line-to-neutral voltages shown in
Figure 4. This mode of operation is called “six-step mode”.
Application Note
9
V1.0, 2008-08
AP08086
Constant V/F Control of Induction Motor
Speed control of Induction motor
Figure 4
Phase Voltage in Six Step Mode
2.3.3
Space Vector Pulse Width Modulation
Space vector pulse width modulation is based on six step mode, but smoothes out the steps through
averaging techniques. For example, if a voltage is required that is between two step voltages, the
corresponding inverter states can be activated in such a way that the average of the step voltages produces
the desired output voltage.
A space vector is denoted by a magnitude and an angle. As time increases, the angle of the space vector
0
increases, causing the vector to rotate. This produces three line-to-line sinusoidal voltages that have 120
phase shifts.
Application Note
10
V1.0, 2008-08
AP08086
Constant V/F Control of Induction Motor
Speed control of Induction motor
U1
(1,1,0)
Us
Sector 0
Tb
U0
(1,0,0)
Ta
Figure 5
Approximate of Space Vector Us by Ta and Tb
The goal of space vector pulse width modulation is to generate the appropriate PWM signals so that any
vector can be produced. Consider a space vector (Us) located in the sector 0 defined by U0 and U1, as shown
in the Figure 5. The desired space vector (Us) can be obtained by applying U0 for a percentage of time (Ta)
and U1 for a percentage of time (Tb). In other words, U0 (100) state is active for time Ta, U1 (110) is active for
time Tb and one of the null vectors Uz is active for T0 , where T0=Tp- Ta - Tb. The pulse period is called Tp.
Space vector is represented as
US TP = U0Ta + U1Tb+UzT0
(2.11)
When the modulation index (the magnitude of Us) is less than 0.866, the sum of Ta and Tb will be less than
Tp. The maximum modulation index for space vector pulse with modulation is 0.866. Figure 6 shows a
symmetric or center aligned Space vector modulation implementation.
For a given space vector (Us), switching times can be calculated using the following formulas:
Ta = U[cos(α)
Tb =
sin(α)
3
]
2
U sin(α)
3
(2.12)
Where U = |Us| and α = angle (Us)
Application Note
11
V1.0, 2008-08
AP08086
Constant V/F Control of Induction Motor
Speed control of Induction motor
Figure 6
SVPWM using symmetric PWM for Sector 0
Application Note
12
V1.0, 2008-08
AP08086
Constant V/F Control of Induction Motor
Software Implementation
3
Software Implementation
In this chapter, the implementation of a constant V/F control and SVPWM generation in the XC88x/XC878
microcontrollers are discussed in detail.
3.1
Control System Overview
An implementation of a constant V/F control algorithm for inverter fed induction motors in open loop is shown
in Figure 7. To implement this application in the XC88x/XC878 microcontroller, three on-chip peripheral
modules are needed and they are CCU6E (CAPCOM6E), ADC (Analog-to-Digital Converter) and Timer T2.
Vdc
Speed Reference
Speed
Rampup
∫
α
Space Vector
Modulation
PWM
Unit
M
Inverter
3 phase Induction Motor
|U|
Voltage
Amplitude
Calculation
Figure 7
Current Calculation
Idclink
Rshunt
Implementation of Constant V/F control for Induction motor.
To generate the PWM control signals for the inverter, the CCU6E module is used. For this purpose, timer
T12 and the CC60SR, CC61SR, CC62SR compare registers are used. Timer T12 operation is configured
for center aligned Mode. Dead-time control is enabled for the six PWM signals to avoid shoot-through
current. The control algorithm and over current protection algorithm are executed in timer the T12 period
match ISR.
The timer T13 is configured in single shot mode. It starts synchronously with a T12 zero match. The timer
T13 period match and CC63SR compare events are used to trigger ADC module for current measurement.
The period register of timer T13 (CCU6_T13PR) and CCU6 channel 3 compare register (CCU6_CC63SR)
are updated every second timer T12 period. And this value is always greater than 1.5 times of T12 period
value.
The timer T12 period match interrupt is blocked in the timer T12 period match ISR and released in timer T13
period match ISR. As a result of this setup, the timer T12 period match ISR is triggered in every second T12
period match.
The ADC module is used for measurement of the motor current and speed reference value. Channel 3 and
Channel 4 are used for the measurement of current at different time instants from a single current shunt.
The measurement results of channel 3 and channel 4 are stored in result register 0 and 1 respectively. Also
channel 0 is configured to measure the speed reference value and the result is stored in result register 2.
In the Timer T2 overflow interrupt service routine, the voltage amplitude is calculated from the input speed
reference value which is stored in result register 2. Also the Speed ramp up rate is controlled using Timer
T2.
Application Note
13
V1.0, 2008-08
AP08086
Constant V/F Control of Induction Motor
Software Implementation
3.2
CCU6 Timer T12 Period Match Interrupt
During this interrupt routine, all calculations necessary for constant V/F control is executed like the angle
calculation, SVPWM generation, update of the CCU6E compare registers and over current check.
T12 Period Match ISR
Disable T12 PM Interrupt
Vector Angle Calculation
Sector and Sector Angle
calcaulation
SVPWM
Update CCu6 Register
Motor Current Calculation
If current > set value
Yes
Stop Motor
No
Return
Figure 8
Flow chart T12 Period Match ISR
3.2.1
T12 Period Match ISR Disabled
Exit
As the execution of all calculations takes longer than one T12 period cycle, T12 period match ISR has to be
disabled during calculation. It is enabled after measuring the current value by timer T13 period match ISR.
Application Note
14
V1.0, 2008-08
AP08086
Constant V/F Control of Induction Motor
Software Implementation
3.2.2
Angle Calculation
The vector angle is derived by integrating the motor speed over a time period. As the control strategy used
here is open loop, the actual motor speed is neither measured nor calculated by any feedback mechanism.
Thus the reference speed is used for the vector angle calculation.
In the actual implementation, integral calculation of vector angle is achieved by simple summation of the
reference speed over a time period.
Now the scaling of all parameters involved in this angle calculation should be taken care of both at the input
and output side as the final result of the angle calculation will be used by the SVPWM algorithm for which the
15
15]
CORDIC coprocessor is used. The value range of input to the CORDIC processor is [2 -1, 2 . Hence the
15
15
output vector angle range [-π,π] is represented as [2 -1, 2 ]
At the input side, the scaling for speed should be taken care of in such a way that the summation of this
value gives the vector angle value.
The speed scaling value is calculated as shown below:
Nspeed =
Where Pp
ΔT
2 15 * 60
(3.1)
ΔT * 2 16 * Pp
- Number of Poles
- Function call time (2*T12PM)
The relation between actual value, normalization value and target value is given below
T arg et_Value =
Actual _ Value * 2 15
Normalization _ value
3.2.3
Space Vector Modulation
3.2.3.1
Calculation of PWM duty cycle for SVM
(3.2)
To generate six PWM signals (two signals for each phase), a reference voltage vector (Us) is required to
determine the switching states and the corresponding duty cycle values. The voltage vector is represented
in terms of magnitude (U) and sector angle (α). The voltage magnitude (U) can be obtained by multiplying
the reference speed value with V/F constant. This calculation is done in every Timer T2 overflow ISR. Sector
and sector angle (α) are calculated from vector angle, and this calculation is done using the MDU
coprocessor.
The Code for the sector angle calculation is shown in Figure 9
Application Note
15
V1.0, 2008-08
AP08086
Constant V/F Control of Induction Motor
Software Implementation
//Sector = (int)(((Angle)*6)>>16) & 0x0007);
MOV
MOV
MOV
MOV
MOV
MDU_MD0,Angle+1
MDU_MD1,Angle
MDU_MD4,#006h
MDU_MD5,#000h
MDU_MDUCON,#10H;
MOV
JB
A,MDU_MDUSTAT
ACC.2,loop1
//Vector Angle Low Byte Value
//Vector Angle High Byte Value
loop1:
// Check whether MDU is ready
MOV Sector+1,MDU_MR2
// Sector value
//AngleTab= (unsigned int)Angle-10922*Sector;
MOV MDU_MD0,MDU_MR0
MOV MDU_MD1,MDU_MR1
MOV MDU_MD4,#006h
MOV MDU_MD5,#000h
MOV MDU_MDUCON,#11H;
//Vector Angle*6 Low Byte Value
//Vector Angle*6 Low Byte Value
MOV
JB
// Check whether MDU is ready
loop2:
A,MDU_MDUSTAT
ACC.2,loop2
MOV SectorAnlge,MDU_MR1
MOV SectorAnlge+1,MDU_MR0
Figure 9
// Sector Angle value
Sector angle calculation using MDU
Given the voltage amplitude (U) and sector angle (α), switching times (Ta and Tb) can be calculated using the
following formulae.
Ta = U[cos(α)
Tb =
sin(α)
3
] =
2
U sin(60 α)
3
2
U sin(α)
3
(3.3)
Where U = |Us| and α = angle (Us)
In general, a look-up table could be used for calculating sine and cosine of the sector angle. In a look-up
table approach, the table needs to be updated if the user changes PWM period (timer T12 period value) or
modulation index. In this current implementation, it is possible to avoid the look-up table by using the
CORDIC coprocessor for the sine and cosine calculations. For the calculation of the switching times,
CORDIC coprocessor is used.
CORDIC Configuration
Circular Rotation Mode
Xinital = U
Yinital =0
Zinital = α
Xfinal = K[X cos(Z) –Y sin(Z)]
Yfinal = k[Ycos(Z) + X sin(Z)]
Zfinal =0
MPS=0
Tb = Yfinal
Interrupt Disabled
Table 1
CORDIC Configuration for switching time calculation
Application Note
16
V1.0, 2008-08
AP08086
Constant V/F Control of Induction Motor
Software Implementation
Compare values are calculated from Ta and Tb values using following formulae:
VTa =
VTb =
VTc =
VTd =
Where T12P
3.2.4
1
2
1
2
1
2
1
2
(T12P Ta Tb)
(T12P + Ta Tb)
(T12P + Ta + Tb)
(T12P Ta + Tb)
(3.4)
- PWM period (Timer T12 period value)
Update of CAPCOM6 Registers
The detailed compare values of CAPCOM6 compare registers at each sector is given in Table 2.
Based on the current sector, the corresponding compare values are loaded into the respective shadow
registers. Shadow transfer will happen during timer T13 period match ISR.
Sector
PWM Generation
ADC Trigger
CC60SR
CC61SR
CC62SR
CC63SR
T13PR
0
VTa
VTb
VTc
(3T12P +Tb)/2 +D
(5T12P +Ta)/2 +D
1
VTd
VTa
VTc
(3T12P +Tb)/2 +D
(5T12P +Ta)/2 +D
2
VTc
VTa
VTb
(3T12P +Tb)/2 +D
(5T12P +Ta)/2 +D
3
VTc
VTd
VTa
(3T12P +Tb)/2 +D
(5T12P +Ta)/2 +D
4
VTb
VTc
VTa
(3T12P +Tb)/2 +D
(5T12P +Ta)/2 +D
5
VTa
VTc
VTd
(3T12P +Tb)/2 +D
(5T12P +Ta)/2 +D
Table 2
3.2.5
Compare Values for CAPCOM6 compare registers at each sector
Current Measurement
In order to trigger the current measurement very accurately, the amplified voltage of the current shunt is fed
to two ADC channels, which are measured at different time intervals and stored in separate result registers.
The ADC conversions are consecutively started every second period (2*T12) of the modulation. The first
current measurement is triggered by the compare match of CC63 and sampled by the ADC channel 3. The
second measurement by ADC channel 4 is triggered by the period match of timer T13. ADC channel 3 is
used to measure the positive current and channel 4 measures the negative current. Figure 10 shows the
usage of timers T12 & T13, the interaction of the timer interrupts, and the event triggers for the start of ADC
conversions.
Application Note
17
V1.0, 2008-08
AP08086
Constant V/F Control of Induction Motor
Software Implementation
Figure 10
Timing Diagram of Timer T12 and T13
The following table describes, the motor phase current measured at each sector during both trigger events.
Sector
Idc link
Table 3
0
1
2
3
4
5
CC63 CM ISR
Ia
Ib
Ib
Ic
Ic
Ia
T13 PM ISR
-Ic
-Ic
-Ia
-Ia
-Ib
-Ib
Phase Current measured at each Sector
Two phase currents are calculated for each sector from the ADC registers. Motor current is computed from
these two phase current values using the MDU coprocessor unit. Over current protection is also
implemented in this software. If the motor current value exceeds the set limit value, motor will be stopped.
The maximum current range is defined as follows:
Im ax =
Where Vadcref
Vadcref
Rshunt * Gop
(3.5)
- ADC reference Voltage
RShunt
- Current shunt resistor value
GOP
- Amplifier gain
In this implementation 10 bit ADC value is multiplied by 8. The current scaling is given below.
NI =
Application Note
Im ax * 2 15
(3.6)
8 * 2 10
18
V1.0, 2008-08
AP08086
Constant V/F Control of Induction Motor
Software Implementation
3.3
Timer T2 Overflow Interrupt
In this motor control application, Timer T2 is used to generate interrupts for every 300 µS. During this
interrupt routine, the speed reference value is read from ADC result register 2 and voltage amplitude value is
calculated.
Figure 11
Flow chart Timer T2 Overflow ISR
Given speed reference value, the voltage amplitude value can be calculated using the following formulae
U =V0 + KVF*fs
Where V0
- Voltage offset value (Is*Rs)
KVF
- V/F Constant
fs
- Supply frequency
fs
Where Ns
(3.7)
=
Ns * Pp
120
(3.8)
- Speed reference value
Application Note
19
V1.0, 2008-08
AP08086
Constant V/F Control of Induction Motor
Software Implementation
The voltage amplitude value depends on the maximum duty cycle of the PWM which is defined by the period
value of timer T12. So V/F constant (KVF) value is scaled depending upon PWM period value (Timer T12).
Normalization value of KVF is given below.
NVF =
Where NV
2 15 * 120 * NV
Nspeed *Pp
(3.9)
- Voltage Normalization value
Nspeed
- Speed Normalization value
Pp
- Number of poles
Voltage normalization value calculation is given below
NV =
Where Vdclink
2 15 * 3 * Vdclink 2 * fpwm
*
3*2
fcpu
(3.10)
- DC link Voltage [v]
fPWM
- PWM frequency
fCPU
- CPU frequency
Speed slew rate is controller by Timer T2. Slew rate calculation is given below
Slew _ Rate =
Where Nspeed
Nspeed
(T2 * TR * 2 15 )
[RPM/S]
(3.11)
- Speed Normalization Value
T2
- Timer Overflow (µS)
TR
- Rampup Counter
Application Note
20
V1.0, 2008-08
AP08086
Constant V/F Control of Induction Motor
Appendix A
Code for Switching Time Calculation
Appendix A
ORL
CLR
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
Code for Switching Time Calculation
SYSCON0,#01
a
CD_STATC,#00
CD_CON,#10
CD_CORDYL,#0
CD_CORDYH,#0
CD_CORDZH,AngleTab
CD_CORDZL,AngleTab+1
CD_CORDXH,Amplitude
CD_CORDXL,Amplitude+1
//switch to mapped SFRs
//sector angle Value
//Voltage Amplitude Value
//CORDIC starts autmatically
loop3:
MOV
JNB
A,CD_STATC
ACC.2,loop3
//wait for CORDIC with circular rotation
MOV
JB
MOV
MOV
SJMP
a,Sector+1
ACC.0,sector_odd1
Tb+1,CD_CORDYL
Tb,CD_CORDYH
sector_exit1
//switching time calculation
Ta+1,CD_CORDYL
Ta,CD_CORDYH
//if sector 1,3,5; Ta=M*sin(sector_angle)
sector_odd1:
MOV
MOV
sector_exit1:
SETB
MOV
SUBB
MOV
SUBB
JNC
CLR
MOV
SUBB
MOV
MOV
SUBB
MOV
SJMP
value_high:
CLR
MOV
MOV
value_exit:
C
a,AngleTab+01
A,#0AAH
A,AngleTab
A,#02AH
value_high
//if sector 0,2,4; Tb=M*sin(sector_angle)
//Calculation of 60-sector angle Value
C
A,#0AAH
A,AngleTab+01H
AngleTab+01H,A
A,#02AH
A,AngleTab
AngleTab,A
value_exit
A
AngleTab,A
AngleTab+01H,A
Application Note
21
V1.0, 2008-08
AP08086
Constant V/F Control of Induction Motor
Appendix A
Code for Switching Time Calculation
ORL
CLR
MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
SYSCON0,#01
a
CD_STATC,#00
CD_CON,#10
CD_CORDYL,#0
CD_CORDYH,#0
CD_CORDZH,AngleTab
CD_CORDZL,AngleTab+1
CD_CORDXH,Amplitude
CD_CORDXL,Amplitude+1
//switch to mapped SFRs
MOV
JNB
A,CD_STATC
ACC.2,loop4
//wait for CORDIC with circular rotation
// 60-sector angle Value
//Voltage Amplitude Value
//CORDIC starts autmatically
loop4:
MOV
JB
MOV
MOV
SJMP
sector_odd2:
MOV
MOV
sector_exit2:
ANL
a,Sector+1
ACC.0,sector_odd2
Ta+1,CD_CORDYL
Ta,CD_CORDYH
sector_exit2
//switching time calculation
//if sector 0,2,4; Ta=M*sin(60-sector_angle)
Tb+1,CD_CORDYL
Tb,CD_CORDYH
//if sector 1,3,5; Tb=M*sin(60-sector_angle)
SYSCON0,#0FEH
//switch to standard SFRs
Application Note
22
V1.0, 2008-08
http://www. inf ineon.com
Published by Infineon Technologies AG