Root Locus Design Controller

 

The second design was derived from the root locus method. The controller I constructed is a PID*PID*PID. The reason I chose three PIDs to control the ball balancer is that I wanted a relative degree of one. By adding a single PID is two zeros and one pole. Therefore, in order to achieve m=1, I needed to add six zeros and three poles. This gave six zeros and seven total poles to the controlled system. Because relative degree of the controlled system was one, this allowed the departure angle of the poles to be multiples of 180 degrees: ± 180+n360; (n = 1,2,3...) . Therefore, the poles departed at 180 degrees and were pulled to the zeros which were all placed as complex conjugates in the left hand plane. I attempted to simulate the controller against the nonlinear system, but because there are seven poles in the controlled system it does not easily simulate a fourth order system. Below is the simulink model and matlab code which simulated the controller, and the resulting root locus and step response.

 

%Project #1

%Ball Balancer

%Controller Design using Root Locus Method

 

global A;

global B;

global K;

global m; % mass of ball

global g; % gravity

global pn; % nominal point

global J; % inertia of the beam

 

% Set Parameter Values

m=1;

g=9.81;

pn=1;

J=8.81;

 

%state space matrices

A=[0 1 0 0; 0 0 -g 0; 0 0 0 1; (-m*g)/(m*pn^2+J) 0 0 0];

B=[0; 0; 0; 1/(m*pn^2+J)];

C=[1 0 0 0];

D=[0];

 

%convert to open loop transfer function

[num,den]=ss2tf(A,B,C,D);

 

k=[-100:0.05:0];

 

%Define Controller: 3 PIDs

kp1=6;

ki1=12;

PID1=[1 kp1 ki1];

 

kp2=10;

ki2=99;

PID2=[1 kp2 ki2];

 

kp3=15;

ki3=100;

PID3=[1 kp3 ki3];

 

den_PID=[1 0 0 0]; % 3 PIDs = s^3 on bottom

 

%Open Loop Tranfer function with Compensator K(s)

numC=conv(PID1,num);

numC=conv(PID2,numC);

numC=conv(PID3,numC);

numC=[-1.0000 -30 -510 -4880 -29000 -89220 -118800];

 

% had to manually enter numC to obtain proper format for matlab to use

denC=conv(den,den_PID);

 

%Close Loop transfer function

kd=-222.6; % stable gain

numC=kd*numC;

subplot(2,1,1)

rlocus(numC,denC);

 

[numc,denc]=cloop(numC,denC,-1);

t=[0:0.001:5];

y=step(numc,denc,t);

subplot(2,1,2)

plot(t,y);

title('Step Response Plot of System with PID Control')

grid

 

p = roots(denC)

K = acker(A,B,p);

 

 

Click here to return to project home page

Linearize Non-linear Equations

Analyze Open Loop System

State Variable Feedback Controller

Root Locus Design Controller

Digital Controller

1