Classical Control Design

Prof S M Veres

University of Southampton

Email: s.m.veres@soton.ac.uk

2008/11/19

sEnglish for Scientist, Engineers and Agents

This document is understandable by any agent produced by the Cognitive Agents Toolbox (www.cognitive-agents-toolbox.com) and by any sEnglish Agent (www.system-english.com).


This paper is an HTML document that can be read and understood by any sEnglish Agent that is available from system-english.com that have the ability to interpret English sentences. Paragraphs in italics, such as this, are informal English inserted by the human author of this document to enhance understanding by human readers. All non-italics text, including titles of sections, are read by the agent, this is not an annotated document with hidden markers of meanings.


CONTENTS

1. Conceptual structures used

2. Closed loop computations

Compute the performance of the feedback loop
Define the feedback loop system
Obtain closed loop transfer function
Study compensator design

3. Utilities

Connect in cascade
Display bode plot
Display step response
Enter transfer function

4. Appendix

Define frequency axis
Define object as property


Conceptual structures used in this paper

This section first outlines the main concepts and objects used, then the basic data object constraints and finally the attributes of concepts and objects that make up the substance of their meaning.

The main concept and their relationships

The main concepts are : feedback loop system, frequency axis, frequency domain plot, transfer function . These do not have any sup classes, they represent root concepts.

The concepts that are subclasses of larger complex classes

An amplitude gain plot is a special case of bode plot and frequency domain plot.

An compensator is a special case of controller and transfer function.

An lag compensator is a special case of controller and transfer function.

An lead compensator is a special case of controller and transfer function.

An phase plot is a special case of bode plot and frequency domain plot.

The special cases of the most significant concept classes

Attributes of an amplitude gain plot

An 'amplitude gain plot' has the following properties: its 'highest frequency' that is a number array, its 'lowest frequency' that is a number array and its 'plot object handle' that is a number array.

Attributes of a bode plot

A 'bode plot' has the following properties: its 'highest frequency' that is a number array, its 'lowest frequency' that is a number array and its 'plot object handle' that is a number array.

Attributes of a closed loop

A 'closed loop' has the following properties: its 'denominator' that is a number array and its 'numerator' that is a number array.

Attributes of a compensator

A 'compensator' has the following properties: its 'lower corner frequency' that is a number array, its 'upper corner frequency' that is a number array, its 'denominator' that is a number array and its 'numerator' that is a number array.

Attributes of a controller

A 'controller' has the following properties: its 'denominator' that is a number array and its 'numerator' that is a number array.

Attributes of a feedback loop system

A 'feedback loop system' has the following properties: its 'plant dynamics' that is a plant and its 'controller dynamics' that is a controller.

Attributes of an frequency axis

An 'frequency axis' has the following properties: its 'starting frequency' that is a number array, its 'ending frequency' that is a number array and its 'frequency values' that is a number array.

Attributes of an frequency domain plot

An 'frequency domain plot' has the following properties: its 'lowest frequency' that is a number array, its 'highest frequency' that is a number array and its 'plot object handle' that is a number array.

Attributes of a lag compensator

A 'lag compensator' has the following properties: its 'denominator' that is a number array and its 'numerator' that is a number array.

Attributes of a lead compensator

A 'lead compensator' has the following properties: its 'denominator' that is a number array and its 'numerator' that is a number array.

Attributes of an nyquist plot

An 'nyquist plot' has the following properties: its 'highest frequency' that is a number array, its 'lowest frequency' that is a number array and its 'plot object handle' that is a number array.

Attributes of a phase plot

A 'phase plot' has the following properties: its 'highest frequency' that is a number array, its 'lowest frequency' that is a number array and its 'plot object handle' that is a number array.

Attributes of a plant

A 'plant' has the following properties: its 'denominator' that is a number array and its 'numerator' that is a number array.

Attributes of a transfer function

A 'transfer function' has the following properties: its 'numerator' that is a number array and its 'denominator' that is a number array.


Closed loop computations

Compute the performance of the feedback loop

Sentences to use: Compute the performance of feedback loop system Cls .

Details of the meaning: Let P be the 'plant dynamics' of Cls. Let C be the 'controller dynamics' of Cls. Connect plant P and compensator C to obtain L. Obtain closed loop F for loop gain L. Define frequency axis W for low frequency 0.1 and high frequency 100. Display step response of P for time period ~10s with title 'Open loop step response' in figure 1. Display the bode plot of P with frequency axis W and title 'Bode Plot of Plant' in figure 2. Display the bode plot of C with frequency axis W and title 'Bode Plot of Compensator' in figure 3. Display the bode plot of F with frequency axis W and title 'Bode Plot of Closed Loop' in figure 4. Display step response of F for time period ~10s with title 'Closed loop step response' in figure 5.

Resulting things are: Cls(feedback loop system) .

Define the feedback loop system

Sentences to use: Define feedback loop system Fb from plant P and compensator C .

Available things are: P( plant) , C( compensator) ,

Details of the meaning: Execute " Fb.plant_dynamics=P;Fb.controller_dynamics=C;".

Resulting things are: Fb(feedback loop system) .

Obtain closed loop transfer function

Sentences to use: Obtain closed loop F for loop gain L .

Available things are: L( transfer function) ,

Details of the meaning: Execute "ln=L.numerator;ld=L.denominator;F.numerator=ln;F.denominator=add_row_vectors(ld,ln)".

Resulting things are: F(closed loop) .

Study compensator design

Sentences to use: Study compensator design .

Details of the meaning: Enter plant P. Enter compensator C. Define feedback loop system Fb from plant P and compensator C. Compute the performance of the feedback loop system Fb.


Utilities

Connect in cascade

Product of two transfer functions in cascade.

Sentences to use: Connect P and C to obtain L .

Available things are: P( transfer function) , C( transfer function) ,

Details of the meaning: Execute "pn=P.numerator;pd=P.denominator; cn=C.numerator;cd=C.denominator;L.numerator=add_row_vectors(conv(pn,cd),conv(pd,cn)); L.denominator = conv(pd,cd);".

Resulting things are: L(transfer function) .

Display bode plot

Sentences to use: Display the bode plot of F with frequency axis W and title 'Bode Plot' in figure 1 .

Available things are: F( transfer function) , W( frequency axis) , T_( quote) , N_( number) ,

Details of the meaning: Execute "figure(N_);bode_o([F.numerator;F.denominator],W,T_);".

Display step response

Sentences to use: Display step response of F for time period ~10s with title 'Title' in figure 1 .

Available things are: F( transfer function) , Q_( physical quantity) , U_( quote) , N_( number) ,

Details of the meaning: Execute "T=strip_physical_quantity(Q_);figure(N_);step_o([F.numerator;F.denominator],T); title(U_);".

Enter transfer function

Sentences to use: Enter transfer function P .

Details of the meaning: Execute "P=object_definition_gui('transfer function');".

Resulting things are: P(transfer function) .


Appendix

Define frequency axis

Sentences to use: Define frequency axis W for low frequency 0.1 and high frequency 100 .

Available things are: N1_( number) , N2_( number) ,

Details of the meaning: Execute "w=logspace(log10(N1_),log10(N2_),100);W.low_frequency=N1_;W.high_frequency=N2_;W.frequency_values=w;".

Resulting things are: W(frequency axis) .

Define object as property

Basic sentence.

Sentences to use: Let O2 be the 'property' of O1 .

Available things are: O1( *) , U_( quote) ,

Details of the meaning: Execute " O2=getfield(O1,U_);".

Resulting things are: O2(*) .


The special data types of numerical arrays, cell arrays and text with constraints

'equation' which is text .
'image' which is text .
'matlab code' which is text .
'number' which is an array of numbers .
'physical quantity' which is text .
'quote' which is text .


Primitives: M-functions of hardware handling, signal processing and basic modelling

function v=add_row_vectors(v1,v2);
n1=length(v1);
n2=length(v2);
if n1 v1=[v1,zeros(1,n2-n1)];
elseif n2 v2=[v2,zeros(1,n1-n2)];
end
v=v1+v2;

function fh=bode_o(tf,w,titl,fh);
k=length(w);
cg=(1:k)';
j=sqrt(-1);
if nargin<3,titl=[];end;
for i=1:k,
cg(i)=ML_function('subs_o___',tf,j*w(i));
end;
amp=20*log10(abs(cg));
phs=180*angle(cg)/pi;
[m,loc]=min(phs+180);
for k=1:length(phs)-1,
if imag(cg(k+1))*imag(cg(k))<0 & imag(cg(k))<0, phs(k+1:end)=phs(k+1:end)-360; end;
if imag(cg(k+1))*imag(cg(k))<0 & imag(cg(k))>0, phs(k+1:end)=phs(k+1:end)+360; end;
end
if nargin<4,
fh=newplot;
else
axes(fh);hold on;
end;
subplot(211),semilogx(w,amp);title(['Gain plot: ' titl]);
a=axis; lin=line([w(loc);w(loc)],[a(3),a(4)]); set(lin,'color','red');
ylabel('dB');grid on;
subplot(212),semilogx(w,phs);title(['Phase plot: ' titl]);
a=axis; lin=line([w(loc);w(loc)],[a(3),a(4)]); set(lin,'color','red');
ylabel('degrees');grid on;
xlabel('frequency (rad/s)');
return;

function display_step_repsonse(F,Q_,U_,N_);
T=strip_physical_quantity(Q_);figure(N_);ML_function('step_o___',[F.numerator;F.denominator],T); title(U_);

function fh=nichols_o(tf,w,titl,tf2);
kw=length(w);
cg=(1:kw)';
j=sqrt(-1);
if nargin<3,titl=[];end;
for i=1:kw,
cg(i)=ML_function('subs_o___',tf,j*w(i));
end;
fh=plot([-180,-270, -180,-180],[0,0,0,40],'.');hold on;
ang=180*angle(cg)/pi;
for k=1:length(ang)-1,
if imag(cg(k+1))*imag(cg(k))<0 & imag(cg(k))<0, ang(k+1:end)=ang(k+1:end)-360; end;
if imag(cg(k+1))*imag(cg(k))<0 & imag(cg(k))>0, ang(k+1:end)=ang(k+1:end)+360; end;
end
gain=20*log10(abs(cg));
plot(ang,gain);
title(titl);
xlabel('open loop phase lag (degrees)');
ylabel('open-loop gain (dB)');
text(ang(1),gain(1), num2str(w(1)));
middle=round(length(w)/2);
text(ang(middle),gain(middle), num2str(w(middle)));
quoter=round(length(w)/4);
text(ang(quoter),gain(quoter), num2str(w(quoter)));
tquoter=round(3*length(w)/4);
text(ang(tquoter),gain(tquoter), num2str(w(tquoter)));
text(ang(end),gain(end), num2str(w(end)));
M=sqrt(2);
xc=M*M/(1-M*M);yc=0; r=M/abs(1-M*M);
p=(1:200)'*2*pi/200;
gx=xc+r*cos(p);gy=yc+r*sin(p);
cg=gx+j*gy;gain=20*log10(abs(cg));
ang=180*angle(cg)/pi;
for k=1:length(ang)-1,
if imag(cg(k+1))*imag(cg(k))<0 & imag(cg(k))<0, ang(k+1:end)=ang(k+1:end)-360; end;
if imag(cg(k+1))*imag(cg(k))<0 & imag(cg(k))>0, ang(k+1:end)=ang(k+1:end)+360; end;
end
ang=ang-360;
plot(ang,gain);
M=sqrt(sqrt(2));
xc=M*M/(1-M*M);yc=0; r=M/abs(1-M*M);
p=(1:200)'*2*pi/200;
gx=xc+r*cos(p);gy=yc+r*sin(p);
cg=gx+j*gy;gain=20*log10(abs(cg));
ang=180*angle(cg)/pi;
for k=1:length(ang)-1,
if imag(cg(k+1))*imag(cg(k))<0 & imag(cg(k))<0, ang(k+1:end)=ang(k+1:end)-360; end;
if imag(cg(k+1))*imag(cg(k))<0 & imag(cg(k))>0, ang(k+1:end)=ang(k+1:end)+360; end;
end
ang=ang-360;
plot(ang,gain);
M=1/sqrt(2);
xc=M*M/(1-M*M);yc=0; r=M/abs(1-M*M);
p=(1:200)*2*pi/200;
gx=xc+r*cos(p);gy=yc+r*sin(p);
cg=gx+j*gy;gain=20*log10(abs(cg));
ang=180*angle(cg)/pi;
for k=1:length(ang)-1,
if imag(cg(k+1))*imag(cg(k))<0 & imag(cg(k))<0, ang(k+1:end)=ang(k+1:end)-360; end;
if imag(cg(k+1))*imag(cg(k))<0 & imag(cg(k))>0, ang(k+1:end)=ang(k+1:end)+360; end;
end
ang=ang-360;
plot(ang,gain);
cg=(1:kw)';
if nargin>3,
for i=1:length(w),
cg(i)=ML_function('subs_o___',tf2,j*w(i));
end;
ang=180*angle(cg)/pi;
for k=1:length(ang)-1,
if imag(cg(k+1))*imag(cg(k))<0 & imag(cg(k))<0, ang(k+1:end)=ang(k+1:end)-360; end;
if imag(cg(k+1))*imag(cg(k))<0 & imag(cg(k))>0, ang(k+1:end)=ang(k+1:end)+360; end;
end
gain=20*log10(abs(cg));
plot(ang,gain);grid
else
grid
end

function fh=nyquist_o(tf,w,titl,fh);
k=length(w);
cg=(1:k)';
j=sqrt(-1);
if nargin<3,titl=[];end;
for i=1:k,
cg(i)=ML_function('subs_o___',tf,j*w(i));
end;
if nargin<4,
fh=newplot;
else
axes(fh);hold on;
end;
plot(-1,0,'x');hold on;
plot(real(cg),imag(cg));grid;
title(titl);

function c=subs_o(T,z);
Tn=T(1,end:-1:1);
Td=T(2,end:-1:1);
c=polyval(Tn,z)/polyval(Td,z);
return;


Ontology source text used

% ID : Classical_Compensator_Design
% Author : S M Veres, October 2008

>transfer function
@numerator: double
@denominator :double
>>plant
>>controller
>>>compensator
@lower corner frequency: double
@upper corner frequency: double
>>>lag compensator
>>>lead compensator
>>closed loop

>frequency domain plot
@lowest frequency: double
@highest frequency: double
@plot object handle:double
>>bode plot
>>>amplitude gain plot
>>>phase plot
>>nyquist plot

>feedback loop system
@plant dynamics: plant
@controller dynamics: controller

>frequency axis
@starting frequency: double
@ending frequency: double
@frequency values: double