- #1
Ethers0n
- 27
- 0
I've been having some trouble figuring out why a controller that I've designed using MATLAB is giving me trouble.
I"m using a polynomial equations approach to the design problem. It seems that the Z transform of the controller's transfer function has near zero values in the numerator. I'm not sure if this is the actual problem, but, it's the only thing I've been able to come up with. I just need a fresh pair of eyes to take a look at it.
There are two different files here. The first produces the transfer function of the plant. The second has the coefficients of the plant transfer function hard coded into it, and is suppossed to produce the transfer function of the controller.
It seems that the Sylvester Matrix in the second file has zeros in, giving me a very small numerator for the controller...giving near infinite gain = bad.
thanks for the help.
And I apologize in advance if the post is long...
first file
%Servo Position Controller
%Using Polynomial Equation Method
%Defining the vairables in the TF
clear all;
Rm = 2.6; %armature resistance
Km = 0.00767; %Back-emf constant
Kt = 0.00767; %motor torque constant
Jm = 3.87e-7; %motor moment of inertia
Jeq = 2.0e-3; %equivalent moment of inertia at the laod
Beq = 4.0e-3; %equivalent viscous damping coefficent
Kg = 70; %srv02 system gear ratio (motor->load) (14X5)
Ng = 0.9; %gearbox efficiency
Nm = 0.69; %motor efficiency
Ts = .001; %sampling time is 1 mili-second
a0 = Jeq*Rm; %defining the terms of plant denominator,
a1 = (Beq*Rm + (Ng*Nm*Km*Kt*(Kg)^2)); %the denominator must be monic
a2 = 0;
b0 = (Ng*Nm*Kt*Kg); %defining terms of plant Numerator
PlantNum = [b0]; %plant numerator
PlantDenom = [a0 a1 a2]; %plant denominator
PlantTF = tf(PlantNum, PlantDenom) %making the plant transfer function
PlantTFz = c2d(PlantTF, Ts) %this produces the Z-Transform of the
%plant transfer function
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
second file
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This part of the file uses the Z-Transformed Plant Transfer Function
%solved for in SRV02part1.m and from the hard-coded variables (of the
%numerator and denominator coefficients, solves the Diophontine Equation
%used to produce a controller using the Polynomial Equation Approach
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% B(z) Y(z)
%------ = ------
% A(z) U(z)
%where A(z) = z^n + a1*z^(n-1) + ...+ a(n-1)*z + a(n)
clear all;
plantnum = [0.3334];
plantden = [0.0052 0.1894 0];
Plant = tf(plantnum, plantden);
Ts = .001; %this is the sampling time
Plantz = c2d(Plant,Ts)
a0 = 1;
a1 = - 1.964;
a2 = 0.9642;
%where B(z) = b0*z^n + b1*z^(n-1) + ...+ b(n-1)*z + b(n)
b0 = 0;
b1 = 3.167e-005;
b2 = 3.129e-005;
E = [a2, 0, b2, 0; %the Sylvester Matrix E for a plant with the equation
a1, a2, b1, b2; %like this (0*z^2) + (w*z) + X
1, a1, b0, b1; % ---------------------
0, 1, 0, b0;] % (q^2) + (g*z) + (y)
%becuase a second order system is desired (from the lab handout)
%the closed loop poles will be at z^2 + 2z + 1 ie at +-45 degrees from the
%axis...
% D = F*H, D = (z^3) + (2z^2) + z + 0 = (d0*z^3)+(d1*z^2)+(d2*z)+d3
% D = [d3
% d2
% d1
% d0]
D = [0;
1;
2;
1;];
M = (inv(E))*D %inverting the Sylvester Matrix and multiplying by D
%this gives the coefficients which will produce the desired
%controller...
% M = [alpha1
% alpha0
% beta1
% beta0]
%The desired controller is of the form
% beta0*z + beta1 Beta(z)
% --------------- = -----------
% alpha0*z + alpha1 Alpha(z)
Alpha = [M(2,1) M(1,1)]; %the alpha(z) term of controller
Beta = [M(4,1) M(3,1)]; %the beta(z) term of the controller
DioControTF = tf(Beta, Alpha, Ts); %feedback regulator or designed controller
%Tz = minreal((Plantz*DioControTF)/(1 + Plantz*DioControTF))
%figure
%step(Tz, 3)
I"m using a polynomial equations approach to the design problem. It seems that the Z transform of the controller's transfer function has near zero values in the numerator. I'm not sure if this is the actual problem, but, it's the only thing I've been able to come up with. I just need a fresh pair of eyes to take a look at it.
There are two different files here. The first produces the transfer function of the plant. The second has the coefficients of the plant transfer function hard coded into it, and is suppossed to produce the transfer function of the controller.
It seems that the Sylvester Matrix in the second file has zeros in, giving me a very small numerator for the controller...giving near infinite gain = bad.
thanks for the help.
And I apologize in advance if the post is long...
first file
%Servo Position Controller
%Using Polynomial Equation Method
%Defining the vairables in the TF
clear all;
Rm = 2.6; %armature resistance
Km = 0.00767; %Back-emf constant
Kt = 0.00767; %motor torque constant
Jm = 3.87e-7; %motor moment of inertia
Jeq = 2.0e-3; %equivalent moment of inertia at the laod
Beq = 4.0e-3; %equivalent viscous damping coefficent
Kg = 70; %srv02 system gear ratio (motor->load) (14X5)
Ng = 0.9; %gearbox efficiency
Nm = 0.69; %motor efficiency
Ts = .001; %sampling time is 1 mili-second
a0 = Jeq*Rm; %defining the terms of plant denominator,
a1 = (Beq*Rm + (Ng*Nm*Km*Kt*(Kg)^2)); %the denominator must be monic
a2 = 0;
b0 = (Ng*Nm*Kt*Kg); %defining terms of plant Numerator
PlantNum = [b0]; %plant numerator
PlantDenom = [a0 a1 a2]; %plant denominator
PlantTF = tf(PlantNum, PlantDenom) %making the plant transfer function
PlantTFz = c2d(PlantTF, Ts) %this produces the Z-Transform of the
%plant transfer function
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
second file
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This part of the file uses the Z-Transformed Plant Transfer Function
%solved for in SRV02part1.m and from the hard-coded variables (of the
%numerator and denominator coefficients, solves the Diophontine Equation
%used to produce a controller using the Polynomial Equation Approach
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% B(z) Y(z)
%------ = ------
% A(z) U(z)
%where A(z) = z^n + a1*z^(n-1) + ...+ a(n-1)*z + a(n)
clear all;
plantnum = [0.3334];
plantden = [0.0052 0.1894 0];
Plant = tf(plantnum, plantden);
Ts = .001; %this is the sampling time
Plantz = c2d(Plant,Ts)
a0 = 1;
a1 = - 1.964;
a2 = 0.9642;
%where B(z) = b0*z^n + b1*z^(n-1) + ...+ b(n-1)*z + b(n)
b0 = 0;
b1 = 3.167e-005;
b2 = 3.129e-005;
E = [a2, 0, b2, 0; %the Sylvester Matrix E for a plant with the equation
a1, a2, b1, b2; %like this (0*z^2) + (w*z) + X
1, a1, b0, b1; % ---------------------
0, 1, 0, b0;] % (q^2) + (g*z) + (y)
%becuase a second order system is desired (from the lab handout)
%the closed loop poles will be at z^2 + 2z + 1 ie at +-45 degrees from the
%axis...
% D = F*H, D = (z^3) + (2z^2) + z + 0 = (d0*z^3)+(d1*z^2)+(d2*z)+d3
% D = [d3
% d2
% d1
% d0]
D = [0;
1;
2;
1;];
M = (inv(E))*D %inverting the Sylvester Matrix and multiplying by D
%this gives the coefficients which will produce the desired
%controller...
% M = [alpha1
% alpha0
% beta1
% beta0]
%The desired controller is of the form
% beta0*z + beta1 Beta(z)
% --------------- = -----------
% alpha0*z + alpha1 Alpha(z)
Alpha = [M(2,1) M(1,1)]; %the alpha(z) term of controller
Beta = [M(4,1) M(3,1)]; %the beta(z) term of the controller
DioControTF = tf(Beta, Alpha, Ts); %feedback regulator or designed controller
%Tz = minreal((Plantz*DioControTF)/(1 + Plantz*DioControTF))
%figure
%step(Tz, 3)