Post on 07-Nov-2014
MATLAB/Simulink Sample Model Description
― Vecrtor Control Simulation of AC Motor ―
1
Vector Control Simulation of AC Motor 1. Introduction 2 2. Vector Control Model 4 2.1. Vector Control Basic principles 4 2.2. System Modeling 5 2.3. Using SimPowerSystems 7 3. Velocity Sensorless by Adaptive Secondary Flux Observer 8 3.1. Analysis Model and Principles 8 3.2. Modeling of Observer 11 4. Simulation Results 13 5. Conclution 14 6. References 15 7. Exemption from Responsibility 15 8. Author 15 9. Note 15
2
1. Introduction The reasons depicted as below demonstrate that MATLAB/Simulink is a tool suitable for vector control of AC Motor in this article. ・Simulink block diagram can express configuration of the vector control diagram clarifying signal stream by grouping and organizing function unit as subsystem, ・Easy to express matrix formula often used in system expression of motor, ・Able to model and simulate multi domain systems such as electric and mechanical systems as it is simulator for mathematical expression model, ・Embedded Legacy C source code can be verified through simulation with this legacy code as controller and plant model in Simulink block diagram, ・Able to co-simulate with magnetic field analysis software, mechanical analysis software and electric circuit simulator. ・Optional toolboxes and extended blocksets provide solutions for a wide variety of development phases from algorithm design, verification, prototype testing to implementation. Some of the “solutions provided for development phase” are listed below and what is covered in this article is clarified as well.
① Paramter Estimation of Motor
⑤ Implementation on processor
Control System Toolbox
SimPowerSystems
Real-Time WorkshopxPC TargetOptimization Toolbox
Real-Time WorkshopRTW Embedded Coder
Coveredregion
Data Acquisition ToolboxOptimization Toolbox
② Control Design and Analysis
③ Verification by simulation
④ Controller Rapid Prototyping
Figure 1.1 Controller development process and related optional tools
3
In vector control, accuracy of internal parameter such as resister of motor armature and inductance affects control performance. Internal parameters are used, for example, feed-forward compensator of current controller and parameters of observer model in position sensorless. In the process of ① of figure 1.1, some methods are possible such as: the same input voltage is applied to actual motor and motor modeled in Simulink, and from the cost function that minimizes output current deviation, each parameter is estimated in least square method. Data Acquisition Toolbox provides interface with A/D, D/A boards, and allows acquisition of real signal by MATLAB program execution. The Optimization Toolbox, function library providing various optimization methods, is available for optimization calculation for parameter estimation. In the process of ②, Control System Toolbox is available for designing observer based on modern control theory, and verifying its characteristic features. In the process of ③, simulation of the whole system is executed based on the parameters and observers obtained from the processes ① and ②. The SimPowerSystems, electric systems library, provides inverter and motor blocks. Because the prepared Motor block is an ideal model not including non-linearity such as magnetic saturation, a method such as co-simulating with magnetic analysis tool is considered in a more realistic simulation. Real-Time Workshop (“RTW”) can generate C-code from controller modeled by Simulink and implement on MPU or DSP. However, as plant model of simulation is ideal motor model, control parameter tuning may be required for actual machine. In the process of ④, xPC target can be used for real-time simulation of actual motor, and tune parameters on Simulink model while monitoring signal in real time. Auto-tuning through optimization calculation is applicable if Optimization Toolbox is used in conjunction. C code implemented on embedded system requires maximum performance from limited resources. Although the RTW imposes less constraints and provides various solutions such as faster execution and prototype test, generated code include redundancies not directly relevant to implementation. In the process of ⑤, production-quality code suitable for implementation with good readability, customization and performance, can be generated by combining add-on tool of RTW, RTW Embedded Coder.
4
2. Vector Control Model 2.1 Vector Control Basic principles In this section, basic principles of vector control are explained for modeling description. As in figure 2.1, armature current “ I ” of three phase AC motor can be observed as rotating vector by power supply angular velocity, ω, if observed on fixed coordinate system with axis of UVW of which phases are deviated 120 degrees. The current vector can be kept motionless if observed in synchronously rotating coordinate system with the power supply angular velocity. It can be considered as direct-current value . We can simplify the electrical equations by using coordinate transformation technique and the transformation angle can be arbitary selected. In the case of induction motor, it is easy to treat the equations in synchronously rotating coordinate system (d-q frame) with rotor flux linkage vector λr.The equations on the three phase fixed coordinate system (UVW) are converted into two phase fixed coordinate axis (α-β) of which phase are deviated 90 degrees .And then, they are converted into d-q frame by the rotation angle θ in figure 2.2. Then, electrical torque of AC motor can be expressed by outer product of flux vector and current vector in the equation below.
rrme IPT (2.1) where Pm: number of pole pares,
λr: rotor flux vector T
qrdr , Ir: rotor current vector T
qrdr ii
U
V
W
I
λr
α
β
θ
Ir
d
q ω
Figure 2.1 three-phase fixed coordinate system Figure 2.2 two-phase fixed coordinate system and rotating coordinate system Equation (2.1) can be expressed below by treating d axis as rotor flux vector
qsr
drmqrdrme iLMPiPT
where M: coefficient of mutual induction, Lr: rotor self inductance (2.2) Subscript s means stator, r means rotor. Equations (2.2) shows that with rotor flux being constant, the motor torque can be controlled by q axis current of stator. Rotor flux can be expressed as
dsr
dr is
M1
where, τr = Lr/Rr: time constant (2.3) Equations (2.3) shows the rotor flux can be controlled to be constant by d axis current of stater. It allows to control the motor torque using constant target value of current in the same simple way as conventional DC brush motor in coordinate conversion by phase of flux vector.
5
2.2 System Modeling It is important to determine accurate flux vector in induction motor. Some of the methods to detect flux vector include direct detection, where magnetic sensor by hall element is used, and indirect detection, where slip angular frequency is added to the detected rotating angular velocity. Here, we consider model that estimates flux vector and rotating angle using flux observer. This is one of the sensorless methods that do not require magnetic and position sensors.
SpeedController
CurrentController
CoordinateTransformer
Rotating → Fix
CoordinateTransformer
2 axis → 3 axis
CoordinateTransformer
Fix → Rotating
AdaptiveObserver
Inverter
InductionMotor
CoordinateTransformer
3 axis → 2 axis
r
r1tan
SpeedController
CurrentController
CoordinateTransformer
Rotating → Fix
CoordinateTransformer
2 axis → 3 axis
CoordinateTransformer
Fix → Rotating
AdaptiveObserver
Inverter
InductionMotor
CoordinateTransformer
3 axis → 2 axis
r
r1tan
*r *
*
qs
ds
i
i*
*
qs
ds
v
v*
*
v
v
r
r
r
ˆ
ˆ
ˆ
*
*
*
w
v
u
v
v
v
w
v
u
iii
qs
ds
ii
ii
Controller part Figure 2.3 Position sensorless vector control configuration
3vw
2vv
1vua
b
u
v
w
Two_To_Three
u
v
w
a
b
Three_To_Two
Phai* ids*
Subsystem
w*
wTe*
Speed Controller
xx
yy
Theta
x
y
Rotating_To_Fixed
xx
yy
Theta
x
y
Fixed_To_Rotating
atan2(u(2),u(1))
Fcn2
f(u)
Fcn1
f(u)
Fcn
Demux
ids*
iqs*
Ramda_r*
ids_feedback
iqs_feedback
w
vds
vqs
Currnet Controller
va*
vb*
ia
ib
Ram_ar
Ram_br
wr^
Adaptive Observer
3iuvw
2wr*
1Ramda_r* ids*
iqs*
vds*
vqs*
va*
vb*
vb*vb*
ia ia
ib ib
iqs
ids
vu*
vv*
vw*
wr^
wr^
iuiviw
w
Ramd_ar
Ramd_br
theta
theta
Figure 2.4 Modeling example of controller part (note: see at the end of this paper for symbols) Symbol * in figure 2.3 denotes target value, and ^ denotes estimate value (see the end of this paper). Note, as in figure 2.4, configuration diagram of controller part in figure 2.3 is expressed by making each operator element subsystem. Coordinate transformation can be expressed in the equation below.
6
Transformation Equation From fixed coordinate to rotating coordinate ie=Ci From rotating coordinate to fixed coodinate v=CTve From three phase to two phase i2=Di3 From two phase to three phase v3=DTv2 Where;
Rotary matrix: cossinsincos
C,
three-phase to two-phase transformation matrix: )34(sin)32(sin0sin)34(cos)32(cos0cos
32D
where, denotes vector, e denotes direct-current value, T denotes transpose, subscript 2 denotes two-phase, 3 denotes three-phase. This part easily expressed, for example as figure 2.5 shows, by mathematical formula definition of
Fcn block in Simulink.
2y
1x
-u(1)*sin(u(3)) + u(2)*cos(u(3))
Fcn1
u(1)*cos(u(3)) + u(2)*sin(u(3))
Fcn
3Theta
2yy
1xx
Figure 2.5 Internal model of coordinate trasformer subsystem Current controller is PI control loop with feedforward compensater considered in synchronously rotating coordinate system. This model compensates, by feedforward, nonstationary term of power supply frequency, ω, obtained from electric formula of motor’s analogous circuit in orthogonal two axis rotating coordinate system.
2vqs*
1vds*
ids*
Ramda*
w
Out1
feedforward2
iqs*
wOut1
feedforward1
PID
DiscretePID Controller1
PID
DiscretePID Controller
6w
5iqs_feedback
4ids_feedback
3Ramda_r*
2iqs*
1ids*
Figure 2.6 Internal model of currnt controller subsystem Adaptive observer is constructed by two-phase fixed coordinate system.Modeling of adaptive observer is described in the next chapter.
7
2.3 Using SimPowerSystems Motor, PWM Generator and Inverter of carrier wave comparison can be modeled by using
Simulink. If time saving of modeling is desirable, SimPowerSystems, Simulink’s extended option, is available. Synchronous Motor, Induction Motor Drive, DC Motor and others are prepared in the block library. Figure 2.7 on the next page indicates model of the overall system and figure 2.4 indicates internal model of the controller. Reference voltage from CPU subsystem is compared with carrier wave with PWM Generator block provided in SimPowerSystems and generates 6 PWM pulses. The mechanism switches each gate of IGBT of three arm bridge circuit block (block name: Universal Bridge), and drive connected induction motor block. Universal Bridge also allows switching of MOSFET, GTO, Thyristor, ideal switch from menu. Features of the SimPowerSystems are listed as below: ・Modeling in circuit topology using block of symbolized element ・Continuous and discrete simulation modes using Simulink’s stiff ordinary differential equation solver are provided. Faster simulation is achieved in discrete mode. ・Inside of block can be almost referenced. ・Supports automatic code generation tool, RTW, and real time-simulation is achievable ・Many sample demo models related to Motor control, including vector control are provided.
Discrete,Ts = 1e-005 s.
Vdc
v+-
Vab
g
A
B
C
+
-
Universal Bridge
Sw1
Sw
1000
Speed_ref2RPM
1000
Speed_ref1RPM
In1Out1
Sigs
Scope
Signal(s) Pulses
PWM Generator
50
Load2
1
Load1
Tm
mA
B
C
Induction Motor
-K-
Gain2
-K-
Gain
0.96
Flux_ref
In1Out1
Current filter
Ramda_r*
wr*
iuvw
vu
vv
vw
CPU
<Rotor speed (wm)>
<Electromagnetic torque Te (N*m)>
Figure 2.7 Modeling Example using SimPowerSystem
8
3. Velocity Sensorless by Adaptive Secondary Flux Observer 3.1 Analysis Model and Principles Rotor flux should be estimated if the same input voltage as the actual input is applied to the mathematical model simulator that is implemented on the processor. However, when constructing velocity sensorless system, changes of nonstationary velocity term can not be made by actual velocity sensor output ,and the estimated value of flux will deviate from the actual value. So, adaptive observer that modifies incorrect constant term of mathematical model with function of the output deviation is applied (figure 3.1). In this case, the terms of electric angular velocity are regarded as the incorrect terms. State-space expression of induction motor in orthogonal two axis fixed coordinate system can be expressed in the equation below:
CxiBvAxdtdx ss , (3.1)
where,
MLLLLMIC
ILB
JILRILMRJILRILLRMR
A
JI
iii
vvv
iix
rsrs
Ts
rrrrr
rrrsrrs
Tsss
Tsss
Trrss
,10
01
0110
,1001
222
22
22
Note 1: reference: Equation of 2) applies Note 2: See the end of this paper for meanings of each symbol
9
I M
B C
H
1/ s
^A
-++
-
+
+
svsi
rˆ
r
ss iie ˆ
si
x
Speed Adaptivesystem
Figure 3.1 Adaptive Flux Observer Configuration Diagram
State-space expression of observer in figure 3.1 can be expressed in the equation below:
xCiHeBvxAdtxd ss ˆˆ,ˆˆˆ (3.2)
where, H is observer gain, ^ is estimation value, e is current error ss iie ˆ
JILRILMRJILRILLRMR
Arrrrr
rrrsrrs
ˆˆˆ
22
Then, parameter adjusting law of estimation electric angular velocity, ωr, are provided by the following equation using size of outer product of current error vector, e, and estimation flux:
dteJKeJKT
ri
T
rprˆˆˆ
(3.3) Observer gain H is designed in a way to ensure adaptability of control system consisting of adaptive
observer and induction motor, i.e., 0lime
t . Assuming that terms other than velocity estimation value is true value, equation concerning current error, e, can be expressed as below from formulas (3.1) and (3.2). It can be obtained by subtracting (3.1) from (3.2) and define matrix Bω by separating term of ω from system matrix. Its complete derivation is omitted here.
rr
rr
JsG
JBHCAsICeˆ)(
)ˆ()( 14
(3.4)
where, rrr ˆ , I4: 4x4 unit matrix, TIIB
10
Then, consider feedback system comprising linear time-invariant block G(s) and nonlinear time variation block similar to the figure below. Applying Popov’s hyper stability, the following needs to
be satisfied to ensure stability, 0lim e
t . 1) linear time-invariant block G(s) is SPR (Strictly Positive Real). 2) input, v1, and output, w1, of nonlinear time variation block satisfy Popov’s equation for all time t1>t0.
20
1
0 11 dtwvt
t
T
(3.5) where, r0 is constant independent of time
G(s)
P I ××
+-
+-
0
rJ r
rˆ
TrJ )(
ss iie ˆ 1v
1wparameter adjusting law
Figure 3.2 Current error block feedback system It is possible to prove that 2) is satisfied by using e.q.(3.3). Optimal feedback gain H obtained from the only solution of Riccati equation is applied to make G(s) SPR as a condition of 1). H=PCTR-1 (3.6) Riccati equation: 01 TTT QBBCPRPCAPPA (3.7) where, P: Solution of Riccati equation, Q, R: Weight matrix The weight matrices are Q=1, R=y I, respectively (however, y is a small positive number). (3.8)
11
3.2 Modeling of Observer Parameters of motor and each matrix of state-space expression are defined in program (M-file) of MATLAB language, and formula (3.7) is solved using the Control System Toolbox, and optimal feedback is obtained. A program example is shown as follows: Feedback gain is obtained in the last line. [H, P, E] = lqe(A, Bw, C, Q, R) The lqe is a function provided for designing Kalman filter estimator in Control System Toolbox. It returns feedback gain, H, solution of Riccati equation, P, and pole of estimator, E=eig(A-H*C). Once executed, M-file is loaded onto memory (workspace) in MATLAB, and defined as each block parameter of Simulink model. Model example inside the subsystem of adoptive observer in figure 2.4 is indicated in figure 3.4. A key to the modeling is to separate and add nonstationary term (term for ωr) included in system matrix A. You can see that modeling can be easily done using the Integrator block if motor system is expressed in state-space.
Then, stability of transfer function G(s) of linear stationary term is verified. If absolute value of phase difference between input and output is within 90 degrees, adaptive observer operates stably. As indicated as mark of arrow in figure 3.4, the Linearization Point, provided by Simulink Control Design, are located in the relevant input and output points.
Figure 3.3 Program example of M-file
%%%%%% Motor parameters %%%%%%%%%% Ts=2e-6; % Sampling Time (sec)
Rs=0.435; % Stator resistance (Ohms) Lls=2.0e-3; % Stator leakage inductance (H) Rr=0.816; % Rotor resistance (Ω) Llr=2.0e-3; % Rotor leakage inductance (H) M=69.31e-3; % Mutual Inductance (H) Ls=M+Lls; % Stator self inductance (H)
Lr=M+Llr; % Rotor self inductance (H) p=2; % number of pole pairs Ed=1000; % Inverter voltage (V)
Emax=Ed/sqrt(3); % Maximum terminal voltage (V) tr=Lr/Rr; % Time Constant of flux sigma=1-M2/(Ls*Lr);
%%%%%%% State Space Matrix %%%%%%%%%%%%% I=[1 0; 0 1]; J=[0 -1;1 0]; A11 = -(Rs + M2*Rr/Lr2) / (sigma*Ls) * I; A12 = M / (sigma*tr*Ls*Lr) * I;
A21 = M/tr * I; A22= -1/tr * I; A = [A11 A12; A21 A22]; B = [1/(sigma*Ls) * I; zeros(2)];
C = [I zeros(2)]; Bw = [M/(sigma*Ls*Lr) * I; -I]; %%%%%% Weight Matrix %%%%%%%%%%%%%%%%%%
ep = 0.006; R = ep*I; Q = I;
%%%%%% Obtaining Feedback Gain %%%%%%%%%% [H,P,E] = lqe(A,Bw,C,Q,R);
12
Figure 3.4 Example of Adaptive Observer Model Figure 3.5 is a bode diagram of linear time-invariant block G(s) drawn with the LTI Viewer of the Control System Toolbox. From the phase diagram, you can see that weight factor of formula (3.8) γ=1, γ=0.006, are within ±90° across the whole frequency range, and they are stable.
Figure 3.5 Bode diagram of linear time-invaliant block Upper: gain characteristics Lower: Phase characteristics o mark line: γ=0.006, * mark line: γ=1
Out11
Product1
MatrixMultiply
Matrix_Gain3
Bw* u
Matrix_Gain2[zeros(2) I]* u
Matrix_Gain1
J* u
Matrix_Gain
A* u
Gain
-1wr^2
x1
Ramda
Input Point
OutputPoint
13
4. Simulation Results This model includes PI gain that requires tuning for velocity controller, current controller and velocity estimator. Each control parameter is tuned by trial-and-error from response results of simulation. Refer to reference 1) for design method of parameter proportional gain, Kp, integrator gain, K1 of velocity estimator. Figure 4.1 shows simulation results from 0 to 1.5 seconds. 0 to 0.5 seconds show velocity step response when velocity reference value is changed from 0[rpm] to 1000[rpm], 0.5 to 1.0 show velocity step response of 1000[rpm] to 500[rpm], and 1.0 to 1.5 show torque step response when external load torque is changed from 1[N] to 50[N]. Voltage between inverter UVs, armature current, rotating velocity, and transient response of torque are simulated.
Figure 4.1 Simulation Results From the top, voltage between inverter UVs[V], three-phase stator current of motor[A], motor rotating velocity[rpm], and torque[Nm]
14
5. Conclusion This note presents position-sensorless vector control simulation by observer using optimal feedback gain as an example of process from algorithm design to logic verification, by using MATLAB/Simulink. Of cource, same way can be also applied to other motor type (e.g, PMSM). However, some of control method as represent by flux-weakening control, one of the highly efficient control methods of IPMSM, are necessary to consider hysteresis characteristics by magnetic saturation, but not in the simulation presented in this paper. Solutions including magnetic field analysis remain to be examined. Symbol description
R Resistor [Ω] L Self-inductance [H] M mutual inductance [H] θ Rotor flux rotation angle [rad] ω Rotor flux angle velocity [rad/sec] ωr Electric angular velocity [rad/sec] Te Electric torque [N] i current value [A] v voltage value [V] λ Flux linkage Pm number of pole pairs s Laplace operator
Subscript symbol description
s Variable in the stator r Variable in the rotor U, V, W Variables in three-phase fixed coordinate system α,β Variables in orthogonal two-axis fixed coordinate system d, q Variables in orthogonal two-axis rotating coordinate system * Target value ^ Estimation value
Description of signal label in figure 2.4
vds, vqs Voltage target value on d and q axes va, vb Voltage target values onα,βaxes vu, vv, vw Voltage target values on UVW axis ids, iqs Current target values on d and q axes iu, iv, iw Current value on UVW axis ia, ib Current values on α and βaxes * Subscript indicating target value theta Rotor flux rotation angle (power supply angle) w Rotor flux rotating angler velocity (power supply angler velocity) wr Electric angler velocity estimation value Ramd_ar, Ramd_br Rotor flux of α and βaxes
15
6. References 1) “Position Sensorless Control of PM Electric Motor using Adaptive Observer of Rotary Coordinate System”, Institute of Electrical Engineers Journal D (Industrial Application Journal) Vol.123-D No.5 p.600, 2003 Yoshihiko Kinpara 2) ”Robust Adaptive Full-Order Observer Design with Novel Adaptive Scheme for Speed Sensorless Vector Controlled Induction Motors”, IEEE-IECON 2002, PE-03, p. 83-88, 2002 Masaru Hasegawa, Keiju Matsui 3) Vector Control of AC Motor Publisher: Nikkan Kogyo Shinbun Ltd. Author: Takayoshi Nakano 7. Exemption from Responsibility Under no circumstances will CYBERNET SYSTEMS CO.,LTD be liable in any way for in this content, or for any loss or damage of any kind incurred as a result of the use of this content. 8. Author Misao Katoh katoh@cybernet.co.jp Application Engineer CDA Engineering Group, Field Application Engineering Department, Applied Systems First Division CYBERNET SYSTEMS CO.,LTD. 9. Note This model is created using MATLAB products as follows. (1) MATLAB Version 7.4 (R2007a) (2) Simulink Version 6.6 (R2007a) (3) SimPowerSystems Version 4.4 (R2007a) (4) Control System Toolbox Version 8.0 (R2007a) To run simulation of sample model, it is need above products (1) , (2) and (3).