Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Controller Designed in Matlab is blowing up

  1. May 2, 2005 #1
    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 aproach 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)
     
  2. jcsd
  3. May 2, 2005 #2
    Am I correct to assume that you are upset because the step response of your system shoots off to infinity? If so, that means that your system is unstable. Do you know the stability requirements for a discrete time system? Have a look at the roots of the denominator of the transfer function Tz and tell me if you are still surprised that it blows up.

    Just having a few zeroes in your E matrix is not bad. It would be bad if a whole row or column was zero, because then inverting it would make Matlab angry. Your E matrix is not singular, but it is a little bit ill conditioned. But not enough so that it would lead to instability, probably just really large or small gain.
     
    Last edited: May 2, 2005
  4. May 2, 2005 #3
    Well, that's the problem, that transfer function is meant to be stable...i realize that it's not, but am unsure as to how why it's proving unstable. As I understand it, this method is supossed to return a stable controller transfer function.

    Am I wrong in this assumption? Or is the code buggy and I'm not catching it? Is there a way to make the Tz stable, by say adding a proportional gain on the front end? (Wouldn't that defeat the purpose of this method? Because then it would have just been easier to start off by making a PID controller in the first place.)
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Controller Designed in Matlab is blowing up
Loading...