GPM32F011XBV10 Sensorless SMO Control of PMSM Using GPM32F011xB User (English Version)
GPM32F011XBV10 Sensorless SMO Control of PMSM Using GPM32F011xB User (English Version)
Generalplus Technology Inc. reserves the right to change this documentation without prior notice.
Information provided by Generalplus Technology Inc. is believed to be accurate and reliable.
However, no responsibility is assumed by Generalplus Technology Inc. for errors, omissions or any
loss of profit resulting from the use of information contained in this documentation. In addition,
Generalplus products are not authorized for use as critical components in life support
devices/systems or aviation devices/systems, where a malfunction or failure of the product may
reasonably be expected to result in significant injury to the user, without the express written
approval of Generalplus.
Generalplus Technology
No.19, Industry E. Rd. IV, Hsinchu Science Park, Hsinchu City, 30077, Taiwan, R.O.C.
Tel: 886-3-666-2118
Fax: 886-3-666-2117
www.generalplus.com
REVISION HISTORY
TABLE OF CONTENT
1. Introduction ........................................................................................................................................... 5
1.1. General Description.................................................................................................................................... 5
2. PMSM Math Model ................................................................................................................................ 6
2.1. General Description.................................................................................................................................... 6
3. Sliding Mode Observer (SMO) ................................................................................................................. 7
3.1. General Description.................................................................................................................................... 7
3.2. Current Observer ........................................................................................................................................ 8
3.3. Counter EMF Estimation and Calculation ................................................................................................... 8
3.4. Motor Position Estimation and Calculation ................................................................................................ 9
4. GPM32F011xB Introduction .................................................................................................................. 10
4.1. GPM32F011xB Motor Control Module Introduction................................................................................ 10
4.2. Hardware MATH Cordic Module............................................................................................................... 10
5. Sample Code Description ...................................................................................................................... 12
5.1. Hardware General Description ................................................................................................................. 12
5.2. Sample Code File Description ................................................................................................................... 13
5.3. Overall Program Structure ........................................................................................................................ 13
5.4. Main Program Flow Description ............................................................................................................... 14
5.5. PWM Interrupt Program Flow .................................................................................................................. 14
5.6. SMO Library Usage Description ................................................................................................................ 15
6. Appendix: Related Documents .............................................................................................................. 19
1. Introduction
is R L es
N S
vs
m
User is able to derive the motor math model from the motor electrical model, and it’s shown as the
following formula: is is the motor current vector; vs is the input voltage vector; es is the
counter EMF vector; R is the winding resistance and L is the winding inductance.
d
vs Ris L is es … (Formula 2.1)
dt
or
Sliding mode
controller
vs PMSM is
+K
ERROR
d R 1
is is (vs es z )
-K
dt L L i s
In Figure 3.2, SMO consists of current observer and sliding control. With sliding control, the observer
current will be seen as the actual current, and this makes the motor math model approximate to the
actual motor state. User can thus obtain the counter EMF messages in the motor math model, and
can also calculate and estimate the motor angle.
d *
dt
R
L
1
is is* vs es* z … (Formula 3.1)
L
z k sign is* is … (Formula 3.2)
Rewrite Formula 3.1 and 3.2 as discrete function Formula 3.3 and 3.4.
is* n 1 F is* n G vs n es* n zn … (Formula 3.3)
zn k sign is* n is n … (Formula 3.4)
1 Ts
R R
Ts
While F e L
and G 1 e L .
R
d *
es 0es* 0 z … (Formula 3.5)
dt
0 is defined as 0 2f 0 , where f 0 is the filter cutoff frequency. In discrete form, Formula 3.5
es* n 1 es* n 2f 0 zn es* n … (Formula 3.6)
3 sin
es ke … (Formula 3.7)
2 cos
4. GPM32F011xB Introduction
Clock
CORD_STR
FORMAT_SEL “0”
ITERATION 0x0F
CORDIC_XD 0x7FFF
CORDIC_YD 0x7FFF
CORD_BUSY
CORD_INTF
CORDIC_ANGLE 0x100015
Main Loop
eCCU6 Interrupt
OVC Interrupt
(PWM)
Reset
Init.c
OPA_Init();
ACMP_Init();
Initial Chip GPIO_Init();
DMA_Init();
ADC_Init();
CCU8x_PWM_Init();
Initial Variables
Main Loop
V_Alpha pu
V_Beta pu pu E_Alpha
pu SMO
I_Alpha pu E_Beta
I_Beta pu
The Library variable is operated in Q15 format. All the variables used by the Library form a struct
SMO, and a variable name has to be declared when user is going to use it. Variables in the struct are
listed as Table 5.1. Variable struct definition is in smo_v01.h file, and it includes the configurations of
controller parameters and so on.
While using SMO Library, after the variables, 2-phase current (I_Alpha and I_Beta) and 2-phase
voltage (V_Alpha and V_Beta), are input, user will get output 2-phase counter EMF (E_Alpha and
E_Beta).