Appendix A: Rotating (D-Q) Transformation and Space Vector Modulation Basic Principles
Appendix A: Rotating (D-Q) Transformation and Space Vector Modulation Basic Principles
xa
X abc = [ a u bu cu ] x b (A.1)
x c
Xa
Xd
In other words, the transformation from X abc = X b (three-phase coordinates) to Xdq =
X c Xq
(dq rotating coordinates), called Park’s transformation, is obtained through the multiplication
128
β β
b d
βu
bu
q
π θ = ωt
6
π
3
π ο au a ≡α ο αu α
3
π
6
cu
1
1 0
2 cosθ − sin θ 0
[d ou ] = [αυ βυ ου ] sin θ cosθ 0
[α βu οu ] = [a u bu cu ]
2 1
−
3 2
3 1
2
u qu
0 1
u
2 0
1 3 1
− −
2 2 2
1
cosθ − sin θ
2
2 2π 2π 1
[d u qu ou ] = [a u bu cu ] cos( θ −
3 3
) − sin( θ −
3
)
2
cos( θ + 2π ) − sin( θ + 2π ) 1
3 3 2
Figure A.1 Park’s transformation from three-phase to rotating dq0 coordinate system
129
of the vector Xabc by the matrix T:
X dq = TX abc (A.3)
cos( ω t ) − sin( ω t )
2 2
T ' = cos( ω t − 3 π ) − sin( ω t − 3 π )
(A.4)
2 2
cos( ω t + π ) − sin( ω t + π)
3 3
The space vector modulation (SVM) basic principles are shown in Figure A.2. A classical
sinusoidal modulation limits the phase duty cycle signal to the inner circle. The space vector
modulation schemes extend this limit to the hexagon by injecting the signal third harmonic. The
result is about 10% (2/1.73 x 100%) higher phase voltage signal at the inverter output. The PWM
modulation chops alternatively two adjacent phase voltage and zero voltage signals in a certain
pattern producing the switching impulses for the inverter Sa, Sb and Sc. Various SVM modulation
schemes have been proposed in literature [72-78] and some recent analyzes show that there is a
trade-off between the switching loses and the harmonic content, so-called THD, produced by the
SVM modulation [25].
130
b β
1 phase duty cycle limit
dβ dc ds line duty cycle limit
Sa
da dα a, α Sb
1
Sc
clock
c
131
Appendix B: Derivation of the Flux-Weakening Equations
This flux-weakening control method is based on two constraints - constant power and
constant phase voltage vector, Eq.s (B.1) - implemented in the PMSM drive d-q model in Eq.s
(12) to define the id and iq current reference algorithms, Eq.s (B.2). For the sake of simplicity, the
id current base value is set to be zero.
vd = Vdb vq = Vqb
P = v d id + v q iq = Vqb I qb (B.1)
Ωb
Rid − pLq ωiq = − pLq ωI qb ⇒ iq ≈ I qb k Ω
ω ⇒ id = − t 1 − b (B.2)
pLd ω
Riq pLd ωid + k t ω = RI qb + k t Ω b
The linear relationship between id and iq comes from Eq.s (B.2):
pL
iq = I qb 1 + d (B.3)
kt
The critical speed, ωcr, is derived from the VSI maximum current limit, Is, supposed to be
maintained before entering the flux-weakening region, Eq. (B.4) and reached again at ω = ωcr.
Substituting id and iq in Eq. (B.4) with the expressions from Eq.s (B.3), and solving for ω, the
solution for ωcr becomes Eq. (B.5).
Vqb2 + Vdb2
ω cr = Ωb (B.5)
Vqb2 − Vdb2
Applying the PMSM dq model Eq.s (12), in Eq. (B.1), the Eq. (B.6) is derived:
Rid2 + Riq2 − pLqωiq id + pLd ωid iq + k t ωiq = RI qb2 + k t Ωb I qb (B.6)
The constant power is maintained only under the assumption from Eq. (B.7) and negligible
voltage drops across inductances Ld and Lq.
(
Rid2 + Riq2 − RI qb2 ≈ p Lq − Ld ωid iq ) (B.7)
132
B.2 Constant Current Constant Power Control
Besides the constant power, this strategy tries to maintain a constant magnitude of the
phase current vector, as defined in Eq.s (B.9).
Substituting the voltages vd and vq in the power equation by there expressions from the PMSM
drive d-q model, Eq. (B.10), and solving the Eq.s (B.9) for currents id and iq determines the d-q
current references, Eq.s (B.11).
Rid2 − pLq ω iq id + Riq2 + pLd ω id iq + k t ω iq = RI qb2 + k t Ωb I qb (B.10)
Ω Ω
2
iq ≈ I qb b ; id ≈ − I qb 1 − b (B.11)
ω ω
( )
The assumption that k t >> p Ld − Lq id through the entire flux-weakening region is made for the
sake of simplicity and is a reasonable assumption. By neglecting the voltage drop across the stator
resistance R (which is negligible at high speeds) and substituting iq and id from Eq. (B.11) into the
PMSM model Eq.s (12), we can get the vd and vq voltage trajectories:
vd = Vdb = − pLq I qb Ω b
2
ω L ω (B.12)
vq = Vqb + d Vd −1
Ω b Lq Ω b
The critical speed, ωcr, can be obtained by equalizing the vq voltage with its base value Vqb.
The result is the same as the one obtained for the constant voltage, shown in Eq. (B.5). The
prevailing speed at which the vq voltage reaches its minimum, see Figure 29, is calculated from
Eq.s (B.12):
dv q Vqb Vd' Ωb
= + = 0 ⇒ ωp = (B.13)
dω Ωb Ω2 V '
2
Ωb 1 − 2b 1 − − d
ω Vqb
133
B.3 Optimum Current Vector Control
In contrast to constant power flux-weakening strategies, this strategy leaves the active
power to change with the change of the power factor, while maintaining both maximum current
and maximum voltage, Eq.s (B.14). In other words, it uses the maximum accessible power.
Developing the voltage constraint from the voltage equations in Eq.s (12), we are getting
Eq. (B.15).
( Ri ) + ( Ri ) = (− pL Ω I ) + ( RI )
2 2 2 2
d − pLqω iq q + pLd ω id + k t ω q b qb qb + k t Ωb (B.15)
After solving (B.14) for iq and substituting in (B.15), we are getting the quadratic Eq. (B.16) on
the variable id.
Aid2 + Bi d + C = 0 (B.16)
where
Ω2
A = ( pLd ) − pLq( ) (
; B = 2 pLd k t ; C = pLq I qb ) + k t 2 1 − 2b
2 2 2
(B.17)
ω
( ) ( pL I )
2
kt L L2d − L2q
2
q qb Ω b
2
id < 0 ⇒ i d = − 1− 1− d
+ 1 1 − 2
pLd L2d − L2q (B.18)
L2d kt 2 ω
In the case of non-salient PMSM, the solution is more trivial, since A=0:
Ω2
(
pL I
) + k t 2 1 − 2b
2
C q qb ω
id = − = − (B.19)
B 2 pLd k t
Ωb2
id = I p 1 − 1 + K 1 − 2 (B.20)
ω
where
134
L2q − L2d kt Leq I qb2 L2q
Leq = ; Ip = ; K= 2 2 + 1 (B.21)
Ld pLeq Ld I p Leq
Finally, by solving for iq from Eq.s (B.20) and (B.14) we are getting the iq current algorithm for
the OCV flux-weakening control, Eq. (B.22).
2
Ip
2
Ω2
i q = I qb 1 − 1 − 1 + K 1 − b2 (B.22)
I qb ω
The vd and vq trajectories are obtained by substituting id and iq current in voltage Eq.s (12)
by Eq.s (B.20) and (B.22).
Ip
[ ]
2
ω − ω − ω 2 + K (ω 2 − Ω b2 )
2
vd ≈ − pLq iq ω = − pLq I qb 2
(B.23)
I qb
[
vq ≈ pLd id ω + ktω = pLd I p ω − ω 2 + K(ω 2 − Ω b2 ) + kt ω ] (B.24)
The speed where the voltage component vq reaches its minimum from Figure 30, can be
obtained from the first derivative of vq over speed ω in Eq. (B.24).
dvq
(1 + K )ω +k =0
= pLd I p 1 −
( )
2
t
dt ω 2
+ K ω 2
− Ω
b
K
(1 + K )ω kt L 2
q (1 + K )
= 1+ = ⇒ ω = Ωb 2 ⇒ v q = v q min
ω 2 + K (ω 2 − Ωb2 )
2
pLd I p L d L2d
1 − (1 + K ) 2
Lq
(B.25)
135
Appendix C: Program Listings for the PMSM Drive
Small and Large Signal Analyses
As an example, here is given a listing of the Matlab code for the Bode analysis and control
design of the PMSM drive system (modified for the two-column editorial purposes). The output
file, called display, is given on the last page. The system model is developed and stored in the
Simulink file vpbode11.m. Because of the model complexity, only the highest hierarchical level is
given in Figure C.1. However, this model, as well as the time-domain simulation Matlab models
and the equivalent Saber model library, are available at Virginia Power Electronics Center
(VPEC) at Virginia Tech.
136
disp 'Motor Periferies:' Tfr_dc=1.9; % static friction
disp '~~~~~~~~~~~~~~~~~' Bl_dc=0.568*9.55/1000; % viscous damping
disp 'SVM modulation coefficient:' J_dc=0.064; % rotor inertia
Fm=1/sqrt(3) Rext=10; % external stator resistance
disp 'Inverter switching frequency [Hz]:' Wmax_dc=2250/9.55; % max. speed [rad/s] with
fs=44000 a given DC motor load
disp 'Filter inductance per phase [H]:' % Maximum torque with the stator closed by Rext:
Lf=0.34e-3; B1=kt_dc*kb_dc; % torque constant [Nm/(rad/s)]
disp 'DC link voltage [V]:' %B1=0; % open stator windings
Vdc=370 Temax_dc=B1/Rext*Wmax_dc;
%Lq=L; Ld=L; Lf=0; % d and q axis ind. for a non- % Total load on the PMSM shaft:
salient PMSM without external filter inductance J=(J+J_dc); % inertia on the rotor shaft
disp ' ' Tfr=1; % static friction
disp 'Limiters:' Blt=Bl_dc; % viscous damping
disp '~~~~~~~~~' kl=Blt+B1/Rext; % total damping [Nm/(rad/s)]
disp ' ' Wdcmax=2500/9.55; % maximum speed [rad/s] of
disp 'Maximum phase voltage [V]' the DC motor
Vs=Vdc*Fm % ****************************************
disp 'Maximum phase current [A]:' disp ' '
Is=50 disp 'Torque resistance, kl is given as a load torque
disp 'Current scaling factor (normalization) [1/A]:' vs. speed look-up table.'
Kim=1/Is disp 'Load inertia [kgm2]:'
disp 'Speed scaling factor (normalization) [1/(rad/s)] J_load=0.316
Kwm=1/(Wmax) disp 'Total inertia on the rotor shaft [kgm2]:'
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ J=Jm+J_load
% LOAD: disp ' '
% ~~~~~ disp 'Sampling and zero-order hold delays:'
% *************************************** disp '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
% Examples: disp 'Sampling delay [s]:'
% 1) Specified load by look-up table model or T=1.5/fs;
% 2) DC motor (VPEC's testing load): T=20e-6
Ra=0.045; % resistance of the dc motor windings disp 'Zero-order hold delay [s]:'
La=0.33*1e-3; % dc motor windings inductance Tz=1.5/fs
kt_dc=0.56*1.11; % torque sensitivity Ti=20e-6; % sampling delay in current loops [s]
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kb_dc=0.59*0.955*1.11; % voltage sensitivity (if not
saturated kb_dc=kt_dc)
137
disp 'CONTROL' wc=2*pi*fc % desired bandwidth (cross-over
disp '~~~~~~~' frequency) [rad/s]
disp ' ' disp 'Desired phase margin [deg.]:'
disp 'Operating point [rad/s]:' phm_deg=45 % in degrees
disp '~~~~~~~~~~~~~~~~~~~~~~~~' phm=phm_deg*pi/180; % in radians
wop=5000*pi/30 % operating point w[rad/s] disp 'Desired gain margin:'
disp ' ' Gm=0.5 % in absolute units
disp 'Current controllers & decoupling:' Gm_dB=20*log10(Gm) % in dB
disp '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' disp 'Gains of current loop PI controllers:'
disp ' ' Kp=wc*L/(Vs*Kim); % init. guess for proportional
% Sampling delay, T(s)=exp(-sTi) causes phase drop gain of the PI_s regulator (without filter Lf=0)
of approximately 360deg. at frequency 3/Ti, so the Ki=Kp*R/L; % initial guess for integral gain of the
maximum bandwidth (for about 45deg. phase drop PI_s regulator (without filter - Lf=0)
caused by the delay) is about 1/(3*Ti). Also, to avoid disp 'Parallel operating mode:'
the influence of the switching, the cross-over frequency Kpq_p=Kp*(Lq+Lf)/L % proportional gain of the
should be smaller than fs/5. PI_p regulator in q-axis
% To avoid combined influence of above mentioned, Kpd_p=Kp*(Ld+Lf)/L % proportional gain of the
choose the cross-over frequency, fc, smaller or equal to PI_p regulator in d-axis
min(fs/10,1/(5*Ti)). Kiq_p=Kpq_p*R/(Lq+Lf) % integral gain of the PI_p
disp 'Open current loop cross-over frequencies [rad/s] regulator in q-axis
for ideally decoupled system:' Kid_p=Kpd_p*R/(Ld+Lf) % integral gain of the PI_p
disp 'Parallel operating mode:' regulator in d-axis
wcod_p=sqrt((Vs*Kim)^2-R^2)/(Ld+Lf) % open d- disp 'Series operating mode:'
axis loop cross-over frequency Kpq_s=Kp*(4*Lq+Lf)/L % proportional gain of the
wcoq_p=sqrt((Vs*Kim)^2-R^2)/(Lq+Lf) % open q- PI_s regulator in q-axis
axis loop cross-over frequency Kpd_s=Kp*(4*Ld+Lf)/L % proportional gain of the
disp 'Series operating mode:' PI_s regulator in d-axis
wcod_s=sqrt((Vs*Kim)^2-(4*R)^2)/(4*Ld+Lf) Kiq_s=Kpq_s*4*R/(4*Lq+Lf) % integral gain of
% open d-axis loop cross-over frequency the PI_s regulator in q-axis
wcoq_s=sqrt((Vs*Kim)^2-(4*R)^2)/(4*Lq+Lf) Kid_s=Kpd_s*4*R/(4*Ld+Lf) % integral gain of
% open q-axis loop cross-over frequency the PI_s regulator in d-axis
% Desired cross-over frequency: % Series and parallel mode rated speed values (flux-
disp 'Current loop (desired) cross-over freq. [rad/s]:' weakening base speed values):
fc=min(fs/10,1/(5*Ti)); % desired bandwidth (cross- % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
over frequency) [Hz] disp 'Series mode rated speed [rpm]:'
138
wb_s=(-4*R*Is*2*kt+sqrt((4*R*Is*2*kt)^2+(Vs^2- Kpw_s=Kiw_s/wz;
(4*R*Is)^2)*(4*kt^2+... if abs(wp1)-wp2/20<=0
((Lf+4*Lq)*Is)^2)))/(4*kt^2+((Lf+Lq*4)*Is)^2)*9.55 wcs=wc/10;
% rated speed [rpm] Kpw_s=J*wcs/Cw;
disp 'Parallel mode rated speed [rpm]:' Kiw_s=Kpw_s*abs(wp1);
wb_p=(-R*Is*kt+sqrt((R*Is*kt)^2+(Vs^2- end
(R*Is)^2)*(kt^2+((Lf+Lq)*Is)^2)))/... disp 'Speed loop PI compensator gains for the series
(kt^2+((Lf+Lq)*Is)^2)*9.55 % rated speed [rpm] mode:'
disp 'wait' Kpw_s
% Speed Loop Controller (symmetrical optimum): Kiw_s
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ % Parallel mode:
% Evaluation of the load torque profile Cw=3/2*kt*Kwm;
x0=zeros*[]; wp2=Kiq_p*Vs*Kim/R;
options(1)=1e-3; % relative error (default 1e-3). Gw=(wp1+wp2)^3/(8*abs(wp1)*wp2);
options(2)=1e-4; % min. step size (def. tend/2000). wz=Gw*2*abs(wp1)*wp2/(wp1^2+wp2^2);
options(3)=1; % max. step size (default tend/50). Kiw_p=abs(kl1)/Cw*Gw;
tend=1600; Kpw_p=Kiw_p/wz;
[t,x,y]=gear('loadvp',tend,x0,options); if abs(wp1)-wp2/20<=0
load load.mat; wcs=wc/10;
[kl,w1,Tl1] = kload(y); % calling Matlab file kload.m Kpw_p=J*wcs/Cw;
for evaluation of the load resist. (load torque slope) Kiw_p=Kpw_s*abs(wp1);
w=wop; end
for i=1:size(w1)-1 disp 'Speed loop PI regul. gains for the parallel mode:'
if ((w1(i,1)<=w) & (w1(i+1,1)>w)) Kpw_p
kl1=kl(i) Kiw_p
Tlop=Tl1(i) % Without back emf elimin. (equivalent DC motor):
end % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
end % Parallel mode:
kl1=1e-8; Leq_p=Lq+Lf;
wp1=kl1/J wel_p=R/Leq_p;
% Series mode: C_p=1.5*kt^2/(Leq_p*J);
Cw=3/2*(2*kt)*Kwm; A_p=0.5*(wel_p+wp1);
wp2=Kiq_s*Vs*Kim/(4*R); B_p=sqrt(1-4*(wel_p*wp1+C_p)/(wel_p+wp1)^2);
Gw=(wp1+wp2)^3/(8*abs(wp1)*wp2); sp1_p=A_p*(1-B_p); sp2_p=A_p*(1+B_p);
wz=Gw*2*abs(wp1)*wp2/(wp1^2+wp2^2); Kpq_pdc=abs(Leq_p*sqrt(wc^2+sp2_p^2)/(Vs*Kim);
Kiw_s=Gw*abs(kl1)/(2*Cw); Kiq_pdc=abs(Kpq_p*sp1_p);
139
% Series mode: Iqref=Is;
Leq_s=4*Lq+Lf; Tmref=1.5*(2*kt*Iqref+p*4*(Ld-Lq)*Idref*Iqref);
wel_s=4*R/Leq_s; elseif w<st1/9.55
C_s=1.5*4*kt^2/(Leq_s*J); Idref=(Is^2+Ip_s^2)/(2*Ip_s)*((wb_s/9.55/w)^2-1);
A_s=0.5*(wel_s+wp1); Iqref=sqrt(Is^2-Idref^2);
B_s=sqrt(1-4*(wel_s*wp1+C_s)/(wel_s+wp1)^2); Tmref=1.5*(2*kt*Iqref+p*(Ld-Lq)*Idref*Iqref);
sp1_s=A_s*(1-B_s); sp2_s=A_s*(1+B_s); elseif w<=wb_p/9.55
Kpq_sdc=abs(Leq_s*sqrt(wc^2+sp2_s^2)/(Vs*Kim)); Idref=0; Iqref=Is;
Kiq_sdc=abs(Kpq_s*sp1_s); Tmref=1.5*(kt*Iqref+p*(Ld-Lq)*Idref*Iqref);
Kpq_p=Kpq_pdc; elseif w<=st2
Kiq_p=Kiq_pdc; Idref=(Is^2+Ip_p^2)/(2*Ip_p)*((wb_p/9.55/w)^2-1);
Kpq_s=Kpq_sdc; Iqref=sqrt(Is^2-Idref^2);
Kiq_s=Kiq_sdc; Tmref=1.5*(kt*Iqref+p*(Ld-Lq)*Idref*Iqref);
% Closed/open loop switches: else
% ~~~~~~~~~~~~~~~~~~~~~~~~~ Idref=0; Iqref=0; Tmref=0;
c1=-1; % command to open(1)/close(-1) current loops end
c2=-1; % command to open(1)/close(-1) speed loop Tlref=Tmref-Tlop;
c3=-1; % command to open(1)/close(-1) decoup. loops % Determining the oper. point state space variables:
c4=-1; % command to open(-1)/close(1) anti-windup disp 'If you get warning messages: "Divide by zero."
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ or "Matrix is close to singular or badly scaled." or you
% ESTIMATION OF THE STEADY STATE want to speed up convergence process, move slightly
VALUES AND LINEARIZATION OF THE SYSTEM your initial guess vector around the operating point
AT A CHOSEN OPERATING POINT inside the trim command.'
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ disp 'To continue press any key.'
% Descriptions of the 'trim' and 'linmod' commands pause
can be obtained by typing 'help trim' and 'help linmod' w=wop+1; % moving the initial guess around the
commands in the matlab workspace desired operating point
% ALWAYS CHOOSE INITIAL GUESS VALUES disp ' '
SOMETHING HIGHER THAN EXPECTED VALUES disp 'Steady state values at given operating point:'
IN STEADY STATE; TAKE CARE ABOUT DUTY vpbode11; % calling SIMULINK MODEL stored in
CYCLE SATURATION! file vpbode11.m
% Initial guess for the op. point (steady state) values: %Idref=0;
Ip_s=kt/(p*(Lq+Lf)); wmin=0; wmax=2;
Ip_p=2*kt/(p*(4*Lq+Lf)); [x,u,y,dx]=trim('vpbode11',[0;w;0;Iqref;Idref;0;0;0;0;
if w<=wb_s/9.55 0;0;0;0;0],[Idref;Iqref;Tlref;w],[Idref;Iqref;0;0;Idref;I
Idref=0; qref;w;Tmref;w;Iqref;0],[],[1;2;4],[])
140
disp ' ' c1=-1;c2=1;c3=-1; % switch commands for closed
disp 'Locations of state space variables on the simulink current loop analysis
block diagram vpbode11:' [A2,B2,C2,D2]=linmod('vpbode11',x,u);
x0=x; %linearization of the system at the operating point
[sizes,x0,xstr]=vpbode11 for i=1:n
% Idm=Idref; Iqm=Iqref; Id=Idref; Iq=Iqref; [ng1,dg1]=ss2tf(A2,B2,C2(i,:),D2(i,:),1);
% CLOSED SPEED LOOP TRANSFER FUNCTIONS nng1(i,1:length(ng1))=ng1;
% ************************************ ddg1(i,1:length(dg1))=dg1;
c1=-1;c2=-1;c3=-1; % commands for closed speed loop [ng2,dg2]=ss2tf(A2,B2,C2(i,:),D2(i,:),2);
[A1,B1,C1,D1]=linmod('vpbode11',x,u); nng2(i,1:length(ng2))=ng2;
% linearization of the system at the operating point ddg2(i,1:length(dg2))=dg2;
% Outputs: [ng3,dg3]=ss2tf(A2,B2,C2(i,:),D2(i,:),3);
% 1 - id current (sampled) nng3(i,1:length(ng3))=ng3;
% 7 - motor speed [rad/s] ddg3(i,1:length(dg3))=dg3;
% 2 - iq current (sampled) end
% 8 - motor torque [Nm] % OPEN CURRENT LOOP TRANS. FUNCTIONS
% 3 - duty cycle command in d-axis, d_d % ************************************
% 9 - reference speed [rad/s] % a) with decoupling:
% 4 - duty cycle command in q-axis, d_q c1=1; c2=1; c3=-1; % open current loop commands
% 10 - reference iq current [A3,B3,C3,D3]=linmod('vpbode11',x,u);
% 5 - id current on the motor terminal % linearization of the system at the operating point
% 11 - reference id current for i=1:n
% 6 - iq current on the motor terminal [ng11,dg11]=ss2tf(A3,B3,C3(i,:),D3(i,:),1);
% 12 - speed loop gain (speed PI controller) output nng11(i,1:length(ng11))=ng11;
n=12; % number of outputs ddg11(i,1:length(dg11))=dg11;
for i=1:n [ng22,dg22]=ss2tf(A3,B3,C3(i,:),D3(i,:),2);
[ng33,dg33]=ss2tf(A1,B1,C1(i,:),D1(i,:),3); nng22(i,1:length(ng22))=ng22;
nng33(i,1:length(ng33))=ng33; ddg22(i,1:length(dg22))=dg22;
ddg33(i,1:length(dg33))=dg33; end;
[ng34,dg34]=ss2tf(A1,B1,C1(i,:),D1(i,:),4); % b) without decoupling:
nng34(i,1:length(ng34))=ng34; c1=1; c2=1; c3=1; % open current loop commands
ddg34(i,1:length(dg34))=dg34; [A3a,B3a,C3a,D3a]=linmod('vpbode11',x,u);
end; % linearization of the system at the operating point
% CLOSED CURRENT LOOP - OPEN SPEED LOOP for i=1:n
TRANSFER FUNCTIONS [ng11a,dg11a]=ss2tf(A3a,B3a,C3a(i,:),D3a(i,:),1);
% **************************************** nng11a(i,1:length(ng11a))=ng11a;
141
ddg11a(i,1:length(dg11a))=dg11a; disp 'Compensator gains in id current loop:'
[ng22a,dg22a]=ss2tf(A3a,B3a,C3a(i,:),D3a(i,:),2); disp 'Integral gain:'
nng22a(i,1:length(ng22a))=ng22a; Kid_p=Kid_p
ddg22a(i,1:length(dg22a))=dg22a; disp 'Proportional gain:'
end; Kpd_p=Kpd_p
disp ' ' disp 'Compensator gains in iq current loop:'
disp 'SUMMARY' disp 'Integral gain:'
disp '~~~~~~~' Kiq_p=Kiq_p
disp 'Op. point [rpm]:' disp 'Proportional gain:'
w_rpm=y(7)*30/pi Kpq_p=Kpq_p
disp 'Full load (+15deg.C); Vdc=370V; fs=44kHz;' disp 'Speed Loop Compensator Gains:'
disp 'Digital delays: T=1.5/fs; Tz=1.5/fs' disp 'Proportional gain:'
disp ' ' Kpw_p=Kpw_p
if w_rpm<=st1 disp 'Integral gain:'
disp 'Operating mode:' Kiw_p=Kiw_p
disp 'Series' disp 'Estimated load torque slope:'
disp ' ' kload=kl1
disp 'Compensator gains in id current loop:' disp 'Estimated load torque:'
disp 'Integral gain:' Tload=Tlop
Kid_s=Kid_s end
disp 'Proportional gain:' K1_zpk; % zeros, poles & gains
Kpd_s=Kpd_s K1_bp; % Bode, Nyquist & Root Locus plots
disp 'Compensator gains in iq current loop:' diary off
disp 'Integral gain:' disp 'To begin step resp. simulation, press any key.'
Kiq_s=Kiq_s pause
disp 'Proportional gain:' % Step response:
Kpq_s=Kpq_s % ~~~~~~~~~~~~~
disp 'Speed Loop Compensator Gains:' c1=-1;c2=-1;c3=-1;c4=1;
disp 'Proportional gain:' wmin=y(7); wmax=wmin+10;
Kpw_s=Kpw_s vpbode11;
disp 'Integral gain:' x0=x; tf=1;
Kiw_s=Kiw_s options(1)=1e-4; % relative error (tol.)
else options(2)=1e-6; % min step size
disp 'Operating mode:' options(3)=1e-3; % max step size
disp 'Parallel' [t,x,y]=gear('vpbode11',tf,x0,options);
disp ' ' Step_resp % calling the file for plotting the sim. data
142
Clock
Id feedback
3
11 Inport3
Vdc
Dd~ Outport11 Tacc.st.state
1 idref
Inport1 Vdc_link
id~ or Dd~ 3
+ Outport3
+
Sum5 d_d
Step Input3
5 -K-
Outport5 Gain1
1
id
} Outputs of I and P Outport1
Switch12
Step Input1 of the speed PI reg. -K- -K- idm
+ c1
+ 1/Kim1 Constant16
4 Kim1
Inport4 +
Sum12 VSI_large_sig._dq_model +
wref 9 4
Sum10 8 2
-K- -K-
Outport9 Outport4 Outport8 Zero_order_hold_delay Outport2
wref Switch9
143
d_q Tm 1/Kim2 iqm
CONTROL Kim2
-K-
+ 10 6
+ Motor_d-q_model
Step Input2 Gain
Outport10 Load_+15C Outport6
Sum4
iqref Full Torque 7 iq
Dq~ 12
-K- Outport7
2
w
Gain2 Outport12
Inport2 Friction
iq~ or Dq~ speed loop gain
Iq feedback
-K-
LOAD PROFILES:
Kwm
-K-
speed feedback
Load_+15C kl
Full Torque1
Figure C.1 Simulation (Simulink) hierarchical model for control design of PMSM drives
The output file, modified for printing onto one page, is following:
st1 = J=
5500 0.31770000000000
T=
2.000000000000000e-005
Tz =
3.409090909090909e-005
144