Professional Documents
Culture Documents
by
Rajmohan Asokan
Person Number: 50097503
May,2014
Abstract
The objective of this Nonlinear Control course project is to design a
model reference adaptive control (MRAC) to minimize the torque ripple
of Permanent Magnet Synchronous Motor (PMSM). The PMSM is modelled as a current subsystem and a speed subsystem. Another inertial
system is coupled to the motor shaft via a spring which makes the mechanical subsystem a fifth-order system. The MRAC is modified to enable
perfect tracking of the fifth-order system. The simulations are analysed
to understand the performance of the designed MRAC.
500
500
d , q ,
Adaptation Gain matrices
Contents
1 INTRODUCTION
1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . .
4
4
4
19
7 APPENDIX
28
7.1 Model Reference Adaptive Control for Current and Speed Subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
7.2 MRAC of Speed subsystem using Augmented error . . . . . . . . 32
7.3 MRAC of rotary system attached to shaft . . . . . . . . . . . . . 33
1
1.1
INTRODUCTION
Motivation
The field of disturbance elimination has been one of the major areas of research in the control community for a variety of reasons. One of the major
applications of disturbance elimination is in the field of synchronous motor.
Synchronous Motor are used in manufacturing facilities, high precision robotic
actuators, disk drives, electric vehicles and lot of other areas where rotational
and translational motion are required. Speed Control of motors has always
served as a benchmark testing for various model control algorithms. In the last
couple of decades, the focus has shifted to estimating and eliminating periodic
disturbances in synchronous motors which arise due to construction flaws, variation in the electromagnetic parameters over time and possibly other problems
which might contribute to the ripples in motor shaft torque.
1.2
Problem Statement
A permanent magnet synchronous motor is modelled as a current and mechanical subsystem. The current model has coupling non-linear term. The mechanical
model is a second-order linear system with unknown plant parameters. A Model
reference adaptive control (MRAC) is designed exclusively for current and plant
model. A smooth motor torque is generated to have a ripple free velocity profile
of the shaft. Further, another rotary system is added to the systems making
the mechanical model to be fifth-order now. MRAC is now applied to control
the velocity profile of the rotary system attached.
R
1
1
i d = id +
ud +
d T d
Ld
Ld
Ld
(2.1)
R
1
1
i q = iq +
uq
q T q
Ld
Lq
Lq
(2.2)
where,
d = [Lq
d = [e iq
q = [Ld
q = [e id
q6
q12 ]T
e sin(6e )
d0
e
d6
e sin(12e )]
d12 ]T
e cos(6e )
e cos(12e )]
d0 = d0
d6 = 6q6 + d6
q6 = 6d6 + q6
d12 = 12q12 + d12
q12 = 12d12 + q12
The modelling of a permanent magnet synchronous motor can be referred in
[1]. The reason for separate current and speed systems is due to the fact that
current dynamics is faster than the speed dynamics. Due to the non-sinusoidal
magnetic field between stator and rotor, the flux linkages are shown to be
(2.3)
(2.4)
From literature [1],[2] it is found that for control and estimation tasks, it
is good enough to consider harmonics only up to 12th. This is because as the
order of harmonics increases it decays faster and does not capture the entire
effect on the model.
The reference model for the current system is modelled as
i dm = adm idm + bdm rd
i qm = aqm iqm + bqm rq
(2.5)
(2.6)
where the constants adm , bdm , aqm and bqm are selected as per design requirements and rd , rq are the reference signals to the id and iq currents respectively.
The control law is chosen to be
ud = d d
(2.7)
uq = q q
(2.8)
where,
d = [d1
d2
d = [id
rd
q = [q1
q = [iq
d4
d5 ]
q4
q5
d ]T
q2
rq
d3
q3
q6 ]
q ]T
d4
d5 ] = d
q1 = aqm Lq + R
q2 = Lq bqm
[dq
q4
q5
q6 ] = q
On substituting the control law with the ideal parameters in the plant model,
it reduces to the form of the reference model. As the plant parameters are unknown, the ideal values can not be calculated and are therefore estimated for
6
Lq q q
(2.9)
1
i q = aqm eq + bqm rq +
(uq Tq q )
Lq
(2.10)
(2.11)
1
(q q q q )
Lq
(2.12)
e q = aqm eq +
e q = aqm eq +
(2.13)
1
(q q )
Lq
(2.14)
Since the equation relating the q-axis current tracking error and the parameter
estimation error is of first order, it is strictly positive real (SPR). This prompts
the formulation of the adaptive law based on the Lyapunov design. Considering
the Lyapunov function candidate
Vq =
e2q
1 T 1
+
q
2
Lq q q
(2.15)
In the above equation, Lq > 0 since inductance is positive and the adaptation
gain matrix, q > 0 as well making it a positive definite function.
The Lyapunov function derivative is given by
1
1 T 1
V q = aqm e2q + eq q q +
q
Lq
Lq q q
(2.16)
(2.17)
(2.18)
Mm =
3
3
p((Ld Lq )id iq ) p((q6 sin(6e ) + q12 sin(12e ))id )+
2
2
3
p((d0 + d6 cos(6e ) + d12 cos(12e ))iq )
2
(2.19)
The first term does not have any contribution to the motor output torque since
Ld = Lq . The second term does not consist of any DC gain. It only contributes
to the ripple in torque due to the harmonic terms. So its contribution is nullified
by having the d-axis current to be zero by making rd = 0. The third and the last
term is used to provide the reference signal to the q-axis current by considering
the term from hereafter called Current Factor(CF) multiplied by the command
torque Mw
CF =
3
2 p(d0
1
+ d6 cos(6e ) + d12 cos(12e ))
(2.20)
The terms in the current factor are adaptively estimated as they are in the control parameters.
rq = CF Mw
M m = aqm Mm + bqm Mw
(3.2)
The transfer function relating the angular velocity and the command torque
Mw is given by
Kp
(s)
= Wp (s) = 2
Mw (s)
s + a1 s + a0
(3.3)
where,
Kp =
bqm
J
a1 = aqm +
a0 =
Bf
J
aqm Bf
J
(3.4)
Based on model reference control (MRC), the control law is derived to be in the
form of
Mw (s) = 1
1
1
Mw (s) + 2
(s) + 3 (s) + 4 r (s)
(s + )
(s + )
(3.5)
(3.6)
2 =
1
KP
3 =
1
Kp ((a1
4 =
Km
Kp
(3.7)
=c x
(3.8)
where, x is state vector and A,b,c are matrices with appropriate dimensions.
The control law (3.5) is represented as
1 = 1 + Mw
T
where, D = diag(c
(3.9)
2 = 2 + c X
(3.10)
Mw = DX T + 4 r
(3.11)
1), X = [x
2 ]
2 ]
CcT X
(3.12)
(3.13)
where,
A
A0 = 0
cT
0
b
c
0 , Bc = 1 , Cc = 0
0
0
(3.14)
Using the ideal control parameters in the state space equations, the ideal
closed loop transfer function is derived as
X = Ac X + Bc 4 r
(3.15)
= CcT X
(3.16)
10
where,
T
Ac = A0 + B c * D
Therefore,
Gc (s) = CcT (sI Ac )1 Bc 4 = Wm (s)
Therefore the reference model can be represented in state space form as
X m = Ac Xm + Bc 4 r
(3.17)
m = CcT Xm
(3.18)
(3.19)
e = X Xm
(3.20)
and also
By adding and subtracting the ideal control law in the form
T
Bc * DX + Bc 4 r to the augmented plant equation,
T
X = Ac X + Bc 4 r + Bc (Mw * DX 4 r )
(3.21)
= CcT X
(3.22)
c 1 (Mw * T DX 4 r )
e = Ac e + B
4
(3.23)
e1 = CcT e
(3.24)
where,
c = B c
B
4
Substituting the control law in the above equation it is seen that the parameter error is related to the tracking error through the reference model Wm (s)
Since the reference model is of relative degree 2 it is not strictly positive real
(SPR) and hence cannot be used to formulate an adaptive law to estimate the
controller parameters using a Lyapunov function. Therefore, to make it strictly
positive real, a first order polynomial (s + ), > 0 is multiplied by Wm (s) such
that Wm (s)(s + ) is strictly positive real(SPR).
Therefore, the tracking error now becomes
c 1 (s + )(Mwf * T DXf 4 rf )
e = Ac e + B
4
11
(3.25)
where,
Mwf = (s + )1 Mw , Xf = (s + )1 X and rf = (s + )1 r are filtered
signals. The control law is modified to be
Mwf = T DXf + 4 rf
(3.26)
Introducing = and 4 = 4 4
c 1 (T DXf + 4 rf )
e = Ac e + B
4
(3.27)
e1 = CcT e
(3.28)
1 T
( DXf + 4 rf )
4
(3.29)
(3.30)
T DXf + T DX + 4 rf + 4 r
Mw =
The error equations can be re-written by using e =
as
e = Ac e + B1
(3.31)
1 T
( DXf + 4 rf )
4
e1 = CcT e
(3.32)
(3.33)
c + B
c and CcT Bc = 0
In the above equation B1 = Ac B
The Lyapunov function is given by
V =
1 T
1 1
1 1
e P e + | |T 1 + | | 1 42
2
2 4
2 4
(3.34)
In the above function, > 0, > 0 are the design parameters and since Wm (s)
is SPR, from Mayer-Kalman-Yakubovich (MKY) lemma,
ATc P + P Ac = Q
(3.35)
P B1 = Cc
(3.36)
V = eT (Q)
e+ eT P B1 T DXf + eT P B1 4 rf +| |T 1 +|
| 4 4
4
4
4
4
(3.37)
12
(3.38)
= sgn( 1 )e1 rf
4
4
(3.39)
The simulation results show good performance when the initial conditions
of the control law parameters are nearer to ideal values and unsatisfactory performance when it is not near ideal values.
13
Now an adaptation law based on the augmented error method is used and the
performance is evaluated using simulations.
The plant model is once again,
(s)
Kp
= Wp (s) = 2
Mw (s)
s + a1 s + a0
(4.1)
(4.2)
Since the plant parameters are considered to be unknown, the control law is
given by
u = T (t)(t)
(4.3)
As the degree of the plant model is n = 2 the control law has 2n parameters
in (t)
= [1
= [r (t)
4 ]T
(4.4)
and
(t)]T
(4.5)
(4.6)
(4.7)
The equation relating the tracking error and the parameter error is given by
e(t) = Wm (s)[T (t)(t)/1 (t)]
(4.8)
(4.9)
(4.10)
=
T
1+
1+
T
(4.11)
(4.12)
where,
= Wm (s)[]
The simulation results obtained show good performance compared to the
Lyapunov based approach used with initial conditions not nearer to ideal values.
15
The MRAC is now extended to control the velocity of another rotatory system
attached to the shaft of the motor via a spring of stiffness K. The model of the
mechanical subsystem of the PMSM changes now.
(5.1)
(5.2)
(5.3)
(5.4)
K
2 (s)
=
Mm
(J1 J2 )s4 + (J2 Bf )s3 + (J1 K + J2 K)s2 + Bf Ks
(5.5)
(5.6)
(5.7)
(5.8)
where the coefficients, a5 , a4 , a3 , a2 , a1 and a0 are unknown time-varying coefficients to be adaptively estimated.
The reference model is obtained to be
2m
Km
= Wm (s) =
5
4
ref
a5m s + a4m s + a3m s3 + a2m s2 + a1m s + a0m
(5.9)
The adaptation law can not be obtained using Lyapunov approach as the reference model is not SPR due to the relative degree being greater than one.
Therefore the adaptation law is obtained using the augmented error method as
seen in the previous chapter
The procedure is same except for the number of control law parameters
The control law is given by
Mw (s) = T (t)(t)
where, = [1
= [ref (t)
2
1
3
2
6
4
7
5
(5.10)
8
9
7
10
8
2 (t)]T
(5.12)
(5.13)
(5.14)
(5.15)
=
T
1+
17
(5.16)
1+
T
where,
= Wm (s)[]
18
(5.17)
SIMULATION
The simulation of the MRAC for the speed subsystem is done using a reference
signal of r = 5sin(0.5t).
19
20
21
22
23
24
Figure 15: Velocity profile of Plant and Reference for MRAC based on Augmented error
25
26
The parameter convergence and the tracking error are shown below
27
7
7.1
APPENDIX
Model Reference Adaptive Control for Current and
Speed Subsystem
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%Rajmohan Asokan%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%Model Reference Adaptive Control%%%%%%%%%%
%%%%%%%%%%%%%%Current and Speed Subsytem%%%%%%%%%%%%%
function Final version
options=odeset('RelTol',1e-2,'AbsTol',1e-2);
ts=[0 50];
xi(1:4)=0;
xi(5:6)=0;
xi(7:11)=0;
xi(12:14)=[0 -200 0]; % Near ideal initial conditions
% xi(12:14)=[1 -100 1]; % Non-ideal initial conditions
xi(15)=0;
xi(16:18)=0;
xi(19:23)=[5 0 0 0 28];
xi(24:29)=[5 0 0.2 0 0 30];
xi(30:31)=0;
[t,y]=ode45(@exec,ts,xi,options);
28
29
function dx = exec(t,x)
%% Speed Control subsystem
% Reference Model
omega r = 5*sin(0.5*t);
[am,bm,cm,dm] = tf2ss([200000],[1 1200 200000]);
dx(1:2,1) = am*x(1:2)+bm*omega r;
omega m = cm*x(1:2);
% Control law
[ap,bp,cp,dp] = tf2ss([62500000],[1 1000.5125 512.5]);
[af,bf,cf,df]=tf2ss([1],[1 500]);
dx(7:10,1) = blkdiag(af,af,af,af)*x(7:10)+...
blkdiag(bf,bf,bf,bf)*[x(3) x(4) x(5) x(6)]';
X f = blkdiag(cf,cf,cf,cf)*x(7:10);
dx(11,1) = af*x(11)+bf*omega r;
omega rf = cf*x(11);
omega = cp*x(3:4);
% Error
e 1 = (62500000.*x(4))-(200000.*x(2));
dx(12:14,1) = -sign(1/0.0032)* e 1 *diag([12 12 12])*blkdiag(cp,1,1)* X f;
dx(15,1) = -sign(1/0.0032)* e 1 *12*omega rf;
% Command Torque
M w = (dx(12:14,1)'*blkdiag(cp,1,1)* X f)+[x(12) x(13) x(14)]*...
blkdiag(cp,1,1)*[x(3) x(4) x(5) x(6)]'+...
(dx(15,1)*omega rf)+x(15)*omega r;
dx(3:4,1) = ap*x(3:4)+bp* M w;
dx(5) = -500*x(5)+M w;
dx(6) = -500*x(6)+cp*x(3:4);
%%CURRENT LOOP
rd = 0;
CF=1/(1.5*2*(x(27)+x(28)*cos(6*2*x(18))+x(29)*cos(12*2*x(18))));
% rq = CF.* M w;
rq=CF.*sin(0.5.*t);
% Current Subsystem
% Reference Model
a dm = 1000;
a qm = 1000;
b dm = 1000;
b qm = 1000;
dx(16,1)=-a dm. *x(16)+b dm. *rd;
dx(17,1)=-a qm. *x(17)+b qm. *rq;
%% Control law and plant model
dx(18,1)=(62500000.*x(4));
phi d = [2*omega*x(31) 2*omega*sin(6*2*x(18,1)) 2*omega*sin(12*2*x(18))];
phi q = [2*omega*x(30) 2*omega 2*omega*cos(6*2*x(18,1))...
2*omega*cos(12*2*x(18))];
xd=[x(30) rd phi d];
xq=[x(31) rq phi q];
ud = [x(19) x(20) x(21) x(22) x(23)]*xd';
uq = [x(24) x(25) x(26) x(27) x(28) x(29)]*xq';
30
e d = x(30) - x(16);
e q = x(31) - x(17);
dx(19:23,1) = -e d *diag([2 2 0.8 0.8 2])*xd';
dx(24:29,1) = -e q *diag([2 2 0.8 0.8 0.8 2])*xq';
Omega d=[0.0284 0.0036 0.0022];
Omega q=[0.0284 0.303 0.0181 0.0024];
% Plant model
R=33.6;
Ld=0.0284;
Lq=0.0284;
dx(30,1) = -(R./Ld)*x(30)+(1./Ld).*ud+(1./Ld).*(Omega d* phi d');
dx(31,1) = -(R./Lq)*x(31)+(1./Lq).*uq-(1./Lq).*(Omega q* phi q');
31
7.2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%Rajmohan Asokan%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%MRAC of Speed subsystem using Augmented error%%%%%%%%
function MRAC augmented error
initial=zeros(25,1);
[t,z]=ode45(@exec,[0 100],initial);
[am,bm,cm,dm]=tf2ss([200000],[1 1200 200000]);
Q ref=z(:,1:2)*cm';
[ap,bp,cp,dp]=tf2ss([62500000],[1 1000.5125 512.5]);
Q2=z(:,11:12)*cp';
plot(t,Q ref,t,Q2);
title('Speed of the motor shaft','FontSize',15);
legend('Reference','Plant');
xlabel('Time in sec','FontSize',15);
ylabel('Speed in rad/sec','FontSize',15);
figure(2);
plot(t,z(:,5:8));
title('Parameter convergence','FontSize',15);
xlabel('Time in sec','FontSize',15);
clc;
clear all;
function dx = exec(t,x)
rt=sin(0.25*t);
%%
% Reference Model
[am,bm,cm,dm]=tf2ss([200000],[1 1200 200000]);
dx(1:2,1)=am*x(1:2)+bm.*rt;
ym=cm*x(1:2)+dm.*rt;
% dx(1,1)=x(2);
% dx(2,1)=-4.*x(2)-4.*x(1)+4*rt;
%%
% Control law & Plant Model
theta=[x(5);x(6);x(7);x(8)];
[ap,bp,cp,dp]=tf2ss([62500000],[1 1000.5125 512.5]);
yp=cp*x(11:12);
% Plant Output
Omega=[rt;x(9);x(10);yp];
u = theta'*Omega; % Control Input
dx(11:12,1)=ap*x(11:12)+bp.*u;
% Filtered signals
dx(9,1)=-2*x(9)+1*u;
dx(10,1)=-2*x(10)+1*yp;
%%
% Adaptation law
error=yp-ym ;
% Error
dx(15:22,1)=blkdiag(am,am,am,am)*x(15:22)+blkdiag(bm,bm,bm,bm)*Omega;
z1=blkdiag(cm,cm,cm,cm)*x(15:22)+blkdiag(dm,dm,dm,dm)*Omega ;
dx(23:24,1)=am*x(23:24)+bm*(theta'*Omega);
z2=cm*x(23:24)+dm*(theta'*Omega);
eta=(theta'*z1)-(z2); % Auxilliary Error
epsilon=error+(x(25)*eta); %Augmented Error
32
% Parameter Adaptation
dx(5:8,1)=-(sign(0.166)*1*epsilon*z1)/(1+z1'*z1);
dx(25,1)=-1*epsilon*eta/(1+z1'*z1);
7.3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%Rajmohan Asokan%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%MRAC of rotary system attached to shaft%%%%%%%%%%%%%%%%%%%%%%
function project extension
initial = zeros(84,1);
[t,y] = ode45(@exec,[0 200],initial);
[am,bm,cm,dm] = tf2ss([10],[1 2 3 4 1 1]);
ref = y(:,1:5)*cm';
[ap,bp,cp,dp] = tf2ss([5],[1 5 6 8 3 2]);
fol = y(:,16:20)*cp';
error 1=fol-ref;
plot(t,ref,'r--','linewidth',2);
hold on;
plot(t,fol,'-b','linewidth',2);
title('Velocity profile of Reference and Plant of Two-degree system',...
'FontSize',15);
xlabel('Time in sec','FontSize',15);
ylabel('Speed in rad/sec','FontSize',15);
figure(2)
plot(t,y(:,6:15));
title('Parameter Convergence','FontSize',15);
xlabel('Time in sec','FontSize',15);
figure(3)
plot(t,error 1);
title('Speed Tracking Error','FontSize',15);
xlabel('Time in sec','FontSize',15);
function dx = exec(t,x)
rt = sin(0.25*t);
%% Reference Model
[am,bm,cm,dm] = tf2ss([10],[1 2 3 4 1 1]);
dx(1:5,1) = am*x(1:5)+bm*rt;
ym = cm*x(1:5);
%% Control law & Plant model
theta = x(6:15);
% Plant Model
[ap,bp,cp,dp] = tf2ss([5],[1 5 6 8 3 2]);
yp = cp*x(16:20);
Omega = [rt;x(21:28);yp];
% Control Input
u = theta'*Omega;
dx(16:20,1) = ap*x(16:20)+bp.*u;
% Filtered signal
dx(21:24,1) = (3.162*diag([-5 -4 -3 -2]))*x(21:24)+[1;1;1;1].*u;
dx(25:28,1) = (3.162*diag([-5 -4 -3 -2]))*x(25:28)+[1;1;1;1].*yp;
%% Adaptation law
33
error = yp - ym;
dx(29:78,1) = blkdiag(am,am,am,am,am,am,am,am,am,am)*x(29:78)+...
blkdiag(bm,bm,bm,bm,bm,bm,bm,bm,bm,bm)*[rt;x(21:28);yp];
z1 = blkdiag(cm,cm,cm,cm,cm,cm,cm,cm,cm,cm)*x(29:78);
dx(79:83,1) = am*x(79:83)+bm*u;
z2 = cm*x(79:83);
%% Auxilliary Error
eta = (theta'*z1)-z2;
epsilon = error+(x(84)*eta); % Augmented Error
%Paramter Adaptation law
dx(6:15,1) = -(sign(500)*1*epsilon*z1)/(1+z1'*z1);
dx(84,1) = -1*epsilon*eta/(1+z1'*z1);
34
References
[1] V Petrovi and Aleksandar M Stankovic. Modeling of pm synchronous motors
for control and estimation tasks. In Decision and Control, 2001. Proceedings
of the 40th IEEE Conference on, volume 3, pages 22292234. IEEE, 2001.
[2] Mari
an T
arnk and J
an Murgas. Model reference adaptive control of permanent magnet synchronous motor. Journal of Electrical Engineering,
62(3):117125, 2011.
[3] Richard V Monopoli. Model reference adaptive control with an augmented
error signal. Automatic Control, IEEE Transactions on, 19(5):474484,
1974.
[4] Petros A Ioannou and Jing Sun. Robust adaptive control. Courier Dover
Publications, 2012.
[5] Jean-Jacques E Slotine, Weiping Li, et al. Applied nonlinear control, volume
199. Prentice-Hall Englewood Cliffs, NJ, 1991.
35