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. *

Compute the performance of the feedback
loop

Define the feedback loop system

Obtain closed loop transfer function

Study compensator design

Connect in cascade

Display bode plot

Display
step response

Enter transfer function

Define frequency axis

Define object as property

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.

**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) .

**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) .

**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) .

**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.

**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) .

**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_);".

**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_);".

**Sentences to use:** Enter transfer function P .

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

**Resulting things are:** P(transfer function) .

**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) .

**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(*) .

'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 .

n1=length(v1);

n2=length(v2);

if n1

elseif 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;

% 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