You are on page 1of 5

Research on Modeling of BLDCM Control System Based on

S-function Builder

Zhu Dong1 Che Yanbo1 Zhao Lihua2


1
School of Electrical Engineering & Automation, Tianjin University, Tianjin China
E-mail: ybche@tju.edu.cn
2
Tianjin Entry-Exit Inspection and Quarantine Burean of P.R.China
E-mail: zhaolh0@tjciq.gov.cn

Abstract-Based on the analysis of mathematical model of the


Brushless DC motor (BLDCM), a novel method for modeling ªuAº ªR1 0 0º ªiAº ªLM 0 0 º ªiAº ªeAº
and simulation of BLDCM is proposed in this paper. In «u » «0 R 0»˜«i »« 0 LM 0 »˜P˜«i »«e »
« B» « 1 » « B» « » « B» « B» (1)
MATLAB/Simulink, the isolated S-function modules, such as «¬uC»¼ «¬0 0 R1»¼ «¬iC»¼ «¬ 0 0 LM»¼ «¬iC»¼ «¬eC»¼
motor module, speed PI controller module, current hysteresis
controller module, EMF generated module etc are modeled
flexibly with S-function Builder. By the organic combination where uA᧨uB᧨uC are the stator phase voltages,R1 is the
of these modules, the model of BLDCM control system can
be established efficiently. The correctness and effectiveness of stator resistance per phase, iA᧨iB᧨iC are the stator phase
the modeling based on S-function Builder are verified
through the experimental data and waveform. This novel currents, P is the time derivative operator, eA᧨eB᧨eC are the
method is also suitable for verifying the reasonability of back emfs in the respective phases in (1).
other control algorithms and offers a new thinking for
designing and debugging actual motors. 2.3 Torque equations
The electromechanical torque is expressed as
Keywords-Brushless dc motor, S-function Builder, S-function
module.
Te (e A ˜ i A  eB ˜ iB  eC ˜ iC ) / Z 2 ˜M p ˜ i p (2)
I. INTRODUCTION

Due to the advancement of small size, good performance, where  is motor's mechanical speed, p is the peak value
simple structure, high reliability and large output torque, of trapezoidal wave excitation flux᧨ip is the stator phase
the brushless DC motors (BLDCM) have been widely
current.
used in many fields. As Simulink provides no BLDCM
From (2),BLDCM's torque is proportional to current
model, many different methods for modeling have been
amplitude and flux, which is similar to DC motors. As flux
proposed. For example: the method based on transfer
is a constant, to control the torque is to control the stator
function, which is simple to establish and fast to simulate,
current. To generate a constant torque, the stator current is
but not easy to reflect the actual working state of the
required to be square wave and the back emfs trapezoidal
motor; The method by writing S function based on
wave, both of which are strictly synchronous. The
C-MEX function or M files, which can realize more
duration of square wave current is 120 degrees in each
complex algorithms and higher computing speed, but
half cycle[3].
difficult to write [1].In view of these problems, this paper
proposes a novel method for modeling and simulation of
2.4 Motion equations
BLDCM based on S-function Builder, which is intuitive,
BLDCM's motion equations is as follows:
fast and efficient with the use of graphical methods and
modular thinking.
dZ
II. THE MATHEMATICAL MODEL OF BLDCM Te TL  B ˜ Z  J ˜ (3)
dt
2.1 Assumptions
1) The motor’s stator is a star wound type where TL is the load torque, J is the moment of inertia, B is
2) The motor’s three phase are symmetric, including their the damping constant.
resistance, inductance and mutual inductances .
3) There is no change in rotor reluctance with angle due to III. S-FUNCTION MODULES ESTABLISHED BASED ON
non-salient rotor. S-FUNCTION BUILDER
4) There is no misalignment between each magnet and the
corresponding stator winding.[2] The S-Function Builder is a Simulink block that builds an
S-function from specifications and C code.The S-Function
2.2 Voltage equation Builder also serves as a wrapper for the generated
For a symmetrical winding and balanced system, the three S-function in models that use the S-function. To build an
phase stator voltage equation across the motor winding is S-function with the S-Function Builder:
as follows: 1 Set the MATLAB current directory to the directory in
which you want to create the S-function.
2 Create a new Simulink model.
3 Copy an instance of the S-Function Builder block from Fig. 1: S-function modules
the Simulink.
4 Double-click the block to open the S-Function Builder IV. BLDCM MODEL
dialog box.
5 Enter the name of the S-function in the S-function name BLDCM system contains motor, drive and control
field. modules. To reflect the true state of the motor, this paper
6 If the S-function has parameters, enter default values for proposes an establishment for modeling and simulation in
the parameters in the S-function parameters field. Matlab7.0.The system design scheme is shown in Fig.2.
7 Use the specification and code entry panes on the BLDCM modeling system is shown in Fig 3,which
S-Function Builder dialog box to enter information and contains BLDCM module, Speed PI Controller module,
custom source code required to tailor the generated Reference Current module, Current Hysteresis Controller
S-function to your application. module, Torque Calculation module, Speed Calculation
8 If you have not already done so, configure the MATLAB module and Voltage Inverter module.
mex command to work on your system.
9 Click Build on the dialog box to start the build process.
10 Save the model containing the S-Function Builder
block.

Fig. 2: BLDCM system design scheme

I_abc
+
n_ref v 1
-
-K-
Voltage Measurement s
In1 g
Ia In1 + Add1 1/(L-M) Integrator
Out1 Is Product
In2 A
1
In2 Ib
Currennt_ref In3
Out1
In4 DC B
R
Speed Controller Pos Ic In5 220V -
In6 C
+
S1_func v 1
Current Controller IGBT Inverter -
-K-
s Te
Voltage Measurement1
Te
Add2 Gain2 Integrator1
Product1 Add In1 Out1
1
n DC
220V1 In2 Out2
Gain3
+ TL Rotationl Speed
v 1
-
-K-
Voltage Measurement2 s
Add3 Gain4 Integrator2
Product2
1

Gain5
Ea
w Eb
Ec
S4_func Ka
Pos Kb
Kc
S-Function Builder
n_real
-K-
pos
k pos

S3_func

Fig. 3: BLDCM modeling system

4.1 BLDCM module


In the control system simulation model, BLDCM module For a designed motor, back EMF is a function of rotor
is responsible to obtain three-phase BLDC stator current. position and angular velocity. In this simulation, the
The structure diagram is shown in Figure 4. back-EMF is given by S-function compiled by MATLAB.
This paper adopts piecewise linear method [2] to get the The linear-relationship between rotor position and
back emf. As shown in Fig 5, a cycle of 0-360° is divided back-EMF is shown in Table 1.Where:k is the back-EMF
into six phases, each of which can be represented by a constant, Pos is the rotor position signal,  is rotational
straight line. Then the back emfs can be resolved through speed signal.
straight-line equations according to corresponding rotor
position Pos and speed [3].
1 1 Em
-K- 1
Ua s
Ia Ea Pos
Add1 1/(L-M) Integrator
1 -Em

2 R Em
1
-K- 2
Ub s Eb Pos
Ea Ib
4 w Eb Add2 Gain2 Integrator1
Ec -Em
w S4_func
Ka 1
5 Pos Kb Em
Kc Gain3
Pos
S-Function Builder 3 Ec Pos
1
-K- 3
Uc s -Em
Ic ±/3 2±/3 ± 4±/3 5±/3 2±
Add3 Gain4 Integrator2

1 Fig. 5: Three-phase back emf waves


Gain5
Fig. 4: BLDCM module
Table 1. The linear-relationship table between rotor position and back-EMF
Rotor position Ea Eb Ec
0̚/3 k* -k* k**((-Pos)/(/6)+1˅
/3̚2/3 k* k**((Pos-/3)/(/6)-1˅ -k*
2/3̚ k**((2/3-Pos)/(/6)+1˅ k* -k*
̚4/3 -k* k* k**((Pos-)/(/6)-1˅
4/3̚5/3 -k* k**((4/3-Pos)/(/6)+1˅ k*
5/3̚2 k**((Pos-5/3)/(/6)-1˅ -k* k*

Ia
4.2 Speed PI controller module Is
Speed control module adopts discrete PI algorithm in order
to obtain best dynamic performance. The construction Currennt_ref Ib
shown in Fig 6 is simple. Single input: the difference
between reference speed (n_ref) and the actual speed Pos
Ic
(n),single output: the amplitude of reference phase current
Is. Where, Kp is the proportion parameters of PI controller, S-Function Builder
Ki for the integral parameters. Saturation module will keep Fig. 7: Reference current module
the reference phase currents within the required limits .
1
5 4.4 Current hysteresis controller module
n
n Kp 1
Is
Hysteresis control is the fastest control in
2 1 Is
-K-
s Saturation n_ref theory[3].Hysteresis current control module make the
n_ref
Add Ki Integrator Add1 Speed Controller
actual current follow the given current. Select the
Fig. 6: Speed PI module and its package appropriate hysteresis loop width, then the actual current
can keep track of reference current waveform and the
4.3 Reference current module current closed-loop control can be achieved. The module
With the given current signal Is and position signal Pos, block diagram is shown in Figure 8.The input is the
the reference current module is to generate three-phase three-phase reference current and actual current, while the
reference current as direct input of hysteresis current output is the control signal for the PWM inverter. [3]DŽ
control module for comparisons with the actual currents. 1

The relationship between rotor position and reference In1


Relay
2 boolean NOT double
currents is shown in Table 2.The module is programmed In2
Data Type Conversion Logical Data Type Conversion1
by S-function and the package is shown in Fig 7. 3 Operator
In3
Table 2. The relationship table between Relay1 1
4 boolean NOT double Out1
rotor position and reference currents In4
Data Type Conversion2 Logical Data Type Conversion3
Rotor position I_ar I_br I_cr 5 Operator1
In5
0̚/3 Is -Is 0 6
Relay2
boolean NOT double
In6
/3̚2/3 Is 0 -Is Data Type Conversion4 Logical Data Type Conversion5
Operator2
2/3̚ 0 Is -Is
-Is Is 0 Fig. 8: Current hysteresis controller module
̚4/3
4/3̚5/3 -Is 0 Is
4.5 Torque calculation module
5/3̚2 0 -Is Is Based on the electromagnetic torque equation (2), when
the motor starts, the speed  is zero [4],it will produce an
error in the calculation. To eliminate the error, change the
formula into another form shown in equation (4).

Te (eA ˜iA eB ˜iB eC ˜iC)/Z Ka ˜ia Kb ˜ib Kc ˜ic (4)
To verify the static and dynamic performance of the
The torque calculation module shown in Figure 9 can be designed model BLDCM ,the speed is set to 500rpm.
established by formula above. The input is three phase Verification 1: The system starts with no-load, and the
current and back-EMF constant, while the output is the simulation curves of rotational speed, phase current and
torque Te. torque in steady state are shown in Figure 12.
1 Verification 2: The system starts with no-load, while the
Ia disturbance load TL = 1N · m is added at t = 0.3s, and at t
Product
Ea = 0.4s the load is removed. The simulation curves of
4 w Eb
S4_func Ec 2
1
rotational speed, phase current, torque are shown in Figure
w Ka Ib
5 Pos Kb Te 13.The detailed speed disturbance is shown in Figure 14.
Kc Product3 Add n_real
Pos 600

S-Function Builder
3
Ic 500

Product1
400

Figure. 9: Torque calculation module


300

4.6 Speed calculation module


According to the motion equation(3), the speed signal  200

can be obtained from the electromagnetic torque, load


torque and friction torque through addition, multiplication 100

and integral operation[5], and then the electrical degree 0


0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5

signal  and the rotor position signal Pos can be calculated.


Ia
The speed calculation module is shown in Figure 10. 40

20

Where, Pos = %(2), S-function programming. 0

-20
1 -40
1 w 1
Te -K- 1 -60
s s  40
Ib
2 Out1
1/J Integrator3 Integrator4 20

TL Add4 0

-K- -20

-40

B -60
Ic
20

Fig. 10: Speed calculation module 0

-20

4.7 Voltage inverter module -40

-60

For BLDCM, each of the inverter's arm bridge device is 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5

equivalent to a mechanical commutator of DC motor and a 2


Te

PWM current regulator. Modeling for the inverter [3], we


use three-phase full-bridge IGBT module of Simulink's 1.5

SimPowerSystem toolbox, which is shown in Figure 11. 1

1
pulse g
+ 0.5

A +
-
v 1
DC B Ua 0

- Voltage Measurement
220V
C
+
v 2
IGBT Inverter - -0.5

Voltage Measurement1 Ub
-1
+ 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5

DC -
v 3
220V1 Uc
Voltage Measurement2 Fig. 12: The curves of speed, phase current and torque with
no-load
n
600
Fig. 11: Voltage inverter module
500

V. ANALYSIS OF SIMULATION RESULTS


400

The simulation parameters are set as follows:


300

BLDC motor: the stator resistance R = 1,the stator


inductance L = 0.02H,the stator mutual inductance M 200

=-0.06H,inertia moment J = 0.005kg.m2,the damping


constant B = 0.0002N · m · s / rad, the back-EMF constant 100

K = 0.0229,the pole pairs p = 1,the DC power supply is 0


0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5

220 V.
PI controller: Kp = 5,Ki = 0.01.The amplitude of saturate
module is limited to ± 35, which equals the maximum
current signal.
Current hysteresis controller: the upper limit of relay is
10,and the lower limit is 0.
Sampling period T = 0.001s.
Ia
40

20
modeling methods, a method for modeling and simulation
0 of BLDCM based on S-function Builder is proposed in this
-20

-40
paper. With this method, the user only need define the
-60

40
Ib input and output interfaces of functions, and the main
20 functions to achieve. Then the S-function module can be
0

-20
generated automatically, which makes the implementation
-40

-60
and validation of the control algorithm convenient, and the
Ic
40 change and improvement of the control strategy very
20

0 simple.
-20

-40
The innovation is reflected in the new control system
-60
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 modeling method using graphic treatment, which is
Te intuitive, efficient and easy to use. The method can
2
implement complex algorithms with simple syntax. This
1.5 novel method is also suitable for verifying the
reasonability of other control algorithms and offers a new
1 thinking for designing and debugging actual motors.
0.5
REFERENCE
0
[1] ZHONG JUNLIU,JIANG XIAOHUA. Study on Modeling
-0.5 of BLDCM Control System Based on S- function[J].
Micro-computer information, 2007,23(3):273-275.
-1
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
[2] MillerTJE.Brushless Permanent Magnet and Reluctance
Motor Drives[M]. Oxford, New York: Clarendon Press,
Fig. 13: The curves of speed,phase current and torque with 1989.
disturbance load [3] YIN Yun-hua, ZHENG Bin, ZHENG Hao-xin. A Method for
n_real
515 Modeling and Simulation of Brushless DC Motor Control
System based on MATLAB[J].Journal of System Simulation,
510
2008, 20(2): 293-298.
505
[4] Jianwen Shao, Nolan D, Hopkins T. A Novel Direct Back
EMF Detection for Sensorless Brushless DC (BLDC) Motor
500 Drives [C]//Applied Power Electronic Conference and
Exposition, APEC 2002,Seventeenth Annual IEEE. USA:
495
IEEE, 2002, (1): 33-38.
490
[5] Jeon Y S, Mok H S, Choe G H, et al. A new simulation
model of BLDC motor with real back EMF waveform
485
[C]//Proceeding from Computers in Power Electronics. The
7th Workshop on Volume Computers in Power Electronics,
480
2000. USA, 2000: 217-220.
0.26 0.28 0.3 0.32 0.34 0.36 0.38 0.4 0.42 0.44

Fig. 14: The detailed speed disturbance BIOGRAPHY


Zhu Dong obtained his bachelor's degree of electrical engineering from
In Fig 12,when system starts with the reference speed n˙ Nanjing University of Post and Telecommunication in July, 2010. He
500rpm,the response is fast and smooth, and the waves of began his study for a master's degree of electrical engineering in Tianjin
phase current is proper. The motor starts with maximum University in Sept, 2010. During his undergraduate and graduate study,
he received several scholarships, and Excellent Prize in Science and
current(ie, constant maximum torque),which avoids the Technology Innovation Training Program.
strike of large torque and phase currents. After 0.17s of
constant-torque acceleration, the actual speed reaches the Che Yanbo received his B.E degree from Zhejiang University in 1993,
set value, and the speed controller is no longer and obtained his M.E and PhD degrees both from Tianjin University in
saturated;then the system operates in steady state without 1996 and 2002 respectively. The major fields of study were Industrial
Automation and Power System respectively. Now he is an associate
speed static error. As the issue of friction torque is professor in the School of Electrical Engineering & Automation, Tianjin
negligible, the steady state average value of torque equals University and he is the tutor of graduate students majoring in Power
zero. This test verifys that the system has fast response, Electronics and Drives. In recent years his research interests focus on the
small overshoot and no steady state error. field of renewable energy, especially on the inverter technology for the
micro-grid operation. He has taken charge of many projects in the field of
In Fig 13,14,when disturbance load TL˙1N·m is added electrical engineering and control, so far he has published over 50 papers.
into the system at the point of t˙0.3s,the speed drop of
motor is 10rpm,and the average value of torque rises to
1N·m.The system gets back into steady state after
0.02s.This test verifys that the system has short time of
speed recovery, good immunity, and the torque ripple of
motor is small.

VI. CONCLUSION

Based on the analysis of BLDCM mathematical model and

You might also like