Appendix A.
Important Programs
Models, simulations and data analysis were undertaken using the MATLAB R2006b.
Appendix A contains important programs coded in the MATLAB environment
A1. Simulation Initialization
Matlab scripts presented in this section are modified from reference [15]
A11 Simulation I ization File “Startsim m”
4, This file sets up the motor parameters, initial conditions, and
% mechanical loading in the MATLAB workspace for similation
% Load three phase induction motor parameters
motor thp % load motor parameters fran
% motor thp.m
% Initialize to start from standstill with machine unexcited
Psigso = 0; % stator q axis total flux linkage
Psipgro = 0; 4 rotor q axis total flux linkage
Psidso = 0; % stator d axis total flux linkage
Psipdro = 0; , rotor d axis total flux Linkage
wrbysibo = 0; % pu rotor speed
tstop = 10;Appendix A. Important Programs
% program time and output arrays of repeating sequence signal.
% for Tmech
tmech time = [0 0.5 123 tstop]; % base torque operation
Ytmech value = [0 0 0 0 0 O]+Tb;
Yrmech value = [ 25 .25 .25 .25 .25 .25]+Tb;
Yemech value=[ 5 5 .5 .5 .5 .S]4Tb;
Ymech value = [ 75 .75 75 .75 .75 .75)*Tb;
tmech value=[4 1 1 1 1 141;
disp(Set up for running im.m.);
disp(Perform simlation then type return for plots”);
A12 Machine Parameter Initialization File
“motor_1hp m”
% Parameters of a iph induction motor.
wh rated & based values wh
P= 4; % number of poles
frated = 50; % rated frequency in Hz
Vrated = 200; % rated line to line voltage in V
Prated = 746; % rated output power in W
wb = 2spixfrated; % base electrical frequency
we = wb;
whm = 2awb/P; % base mechanical speed
Sb = Prated; % rating output power in VA
Vm = Vratedssqrt(2/3) ; % magnitude of phase voltage
Vb = Vm; % base voltage
Tb = (2#Sb)/(3#Vb) 5 % base current
Zo = Vb/Tb; % base impedance in ohms
Tb = Sb/wom; % base torque
‘hh ‘hh
Tfactor = (3*P)/(4+*wb) 5 % factor for torque expression
N = 28; % total rotor bar number
n= 4; % broken bar numberA.2. Least Squares Prony Method
a0 = 0; initial rotor angle
th machine parameters wh
rs = 3.35; % stator winding resistance in
J. ohms
xls = 6.94e 3+wb; % stator leakage reactance in
f. obs
xplr = xls; /, rotor leakage reactance
am = 163.73e 3+wb; % stator magnetizing reactance
rpr = 1.99; referred rotor wdg resistance
Qin ohms
dr = (rpr*n)/(1/3 n); % broken bar effect
xM = 1/(1/mm + 1/x1s + 1/xplr);
J = 0.15; % rotor inertia in kgm2
H = Jewbmewbm/(2#Sb) 5 , rotor inertia constant in sec
Domega = 0; % rotor damping coefficient
A2 Least Squares Prony Method
‘The Least Square Prony algorithm is modified from [51] in Matlab. Parameters
of the algorithm can vary from oceasion to occasion.
we Least Square Prony Method
‘th Use of SVD
hh Parameters set up ‘hh
close
global order N Z input signal
‘Ydounsample( ; % domsampling if needed
£555
T=1/fs;
t=[0:T:]; % sampling time
input signal = ias; 4 input signal
order = ; % model order
N= length(input signal); 4 mimber of data samples
th step 1: Compose equations and solve the complexAppendix A. Important Programs
‘th coefficients alm] th
x= O35 % compose the X matrix
m=N order;
step = order;
for d= t:order
for j = im
X(d,j) = input signal(step 1 + 3);
end
step = step 1;
end X:
z=;
for 1 = 1:( order)
z(1,1) = input signal (1torder);
end
theta = pinv(O+z; % evaluation of the
% overdetermined linear
% similtaneous equations
wh step 2: Solve the complex roots z wh
LPM = [1 theta’]; % a0=1
rootz = roots(LPM); % roots of LPM the homogeneous
% linear constant: coefficient
% difference equation
Freq = imag(log(rootz))/(2+pi*T) ;
damping factor = log(abs(rootz))/T;
wh step 3: Solve the complex coefficients h wh
20; % compose the Z matrix
for k = 1:0
for m = 1:order
Z(k,m) = rootz(m)~(k 1);A.2. Least Squares Prony Method
end
Vv=V?:
H = pinv(Z)#v;
phase rad = angle(H);
amplitude = abs (HD ;
result=[Freq damping factor phase rad amplitude] ;
disp(? Freq; damping factor; phase rad; amplitude?) ;
disp(result)
Draw the Prony estimation
y=03
for
2:0rder;
yFy+2eamp1itude(n)*exp (damping factor(n) +t) .*
cos(2*pi*Freq(n)*t+phase rad(n));
end
plot(t, input: signal,°k’)
ylabel (Magnitude (A)?)
xlabel Time (s)?)
hold
plot(t,y,?:kx?)
‘legend(?Current Signal’, Prony Estimation?);
xlim([0 length(y)1);