diff options
Diffstat (limited to 'Working_Examples/3432/CH7/EX7.30')
-rwxr-xr-x | Working_Examples/3432/CH7/EX7.30/DEPENDENCIES/fig_settings.sci | 9 | ||||
-rwxr-xr-x | Working_Examples/3432/CH7/EX7.30/DEPENDENCIES/zpk_dk.sci | 43 | ||||
-rwxr-xr-x | Working_Examples/3432/CH7/EX7.30/Ex7_30.sce | 73 | ||||
-rwxr-xr-x | Working_Examples/3432/CH7/EX7.30/Ex7_30_f0.pdf | bin | 0 -> 26005 bytes |
4 files changed, 125 insertions, 0 deletions
diff --git a/Working_Examples/3432/CH7/EX7.30/DEPENDENCIES/fig_settings.sci b/Working_Examples/3432/CH7/EX7.30/DEPENDENCIES/fig_settings.sci new file mode 100755 index 0000000..5d5e7d4 --- /dev/null +++ b/Working_Examples/3432/CH7/EX7.30/DEPENDENCIES/fig_settings.sci @@ -0,0 +1,9 @@ +//------------------------------------------------------------------
+//figure handel settings
+f=get("current_figure"); //Current figure handle
+f.background=8; //make the figure window background white
+l=f.children(1);
+l.background=8 ;//make the text background white
+id=color('grey');
+xgrid(id);
+//------------------------------------------------------------------
diff --git a/Working_Examples/3432/CH7/EX7.30/DEPENDENCIES/zpk_dk.sci b/Working_Examples/3432/CH7/EX7.30/DEPENDENCIES/zpk_dk.sci new file mode 100755 index 0000000..95b4e6c --- /dev/null +++ b/Working_Examples/3432/CH7/EX7.30/DEPENDENCIES/zpk_dk.sci @@ -0,0 +1,43 @@ +//------------------------------------------------------------------ +//------------------------------------------------------------------ +//A function written by Deepti Khimani. +//Usage:- +//p=zpk_dk(sl) +//[p, z]=zpk_dk(sl) +//[p, z, k]=zpk_dk(sl) +//p:- Poles of the system +//z:- zeros of the system +//k:- DC gain of the system +//------------------------------------------------------------------ +//------------------------------------------------------------------ + +function[pl,zr,k]=zpk_dk(sysmodel) + [lhs,rhs]=argn(0) + + if rhs == 0 then + disp(["p=zpk_dk(sl)";"[p, z]=zpk_dk(sl)";"[p, z, k]=zpk_dk(sl)"]); + disp(["p:- Poles of the system";"z:- zeros of the system"]); + disp("k:- DC gain of the system"); + return; + end + + if typeof(sysmodel)=="rational" then + sys=tf2ss(sysmodel); + pl=spec(sys.A); + zr=trzeros(sys); + temp1=poly(zr,'s','roots')/poly(pl,'s','roots'); + temp2=sysmodel/temp1; + temp3=tf2ss(temp2); + k=temp3.D; + elseif typeof(sysmodel)=="state-space" then + pl=spec(sysmodel.A); + zr=trzeros(sysmodel); + g=ss2tf(sysmodel); + temp1=poly(zr,'s','roots')/poly(pl,'s','roots'); + temp2=g/temp1; + temp3=tf2ss(temp2); + k=temp3.D + else + error("Wrong type of input argument.") + end +endfunction diff --git a/Working_Examples/3432/CH7/EX7.30/Ex7_30.sce b/Working_Examples/3432/CH7/EX7.30/Ex7_30.sce new file mode 100755 index 0000000..99e6aae --- /dev/null +++ b/Working_Examples/3432/CH7/EX7.30/Ex7_30.sce @@ -0,0 +1,73 @@ +//Example 7.30
+// Full-Order Compensator Design for DC Servo.
+
+xdel(winsid())//close all graphics Windows
+clear;
+clc;
+//------------------------------------------------------------------
+
+// State space representation
+//Transfer function model for DC Servo
+s=poly(0,'s');
+num=10;
+den=s*(s+2)*(s+8);
+Gs=syslin('c',num/den);
+
+// State space representation
+F=[-10 1 0;-16 0 1;0 0 0];
+G=[0 0 10]';
+H=[1 0 0];
+J=0;
+n=sqrt(length(F));
+//Desired poles for the DC Servo system.
+Pc=[-1.42 -1.04+2.14*%i -1.04-2.14*%i ]
+
+
+// State feedback gain
+K=ppol(F,G,Pc)
+disp(K,'K=',"State feedback gain")
+
+//Estimator - error roots are at
+Pe=[-4.25 -3.13+6.41*%i -3.13-6.41*%i]
+L=ppol(F',H',Pe);
+L=L';
+disp(L,'L=',"Observer gain")
+//------------------------------------------------------------------
+//Compensator Design
+DK=-K*inv(s*eye(n,n)-F+G*K+L*H)*L;
+
+exec('./zpk_dk.sci', -1);
+[p,z]=zpk_dk(DK);
+D=poly(z,'s','roots')/poly(p,'s','roots')
+
+evans(Gs*D)
+zoom_rect([-8 -9 3 9])
+
+f=gca();
+f.x_location = "origin"
+f.y_location = "origin"
+xset("color",2);
+h=legend('');
+h.visible = "off"
+
+//Title, labels and grid to the figure
+exec .\fig_settings.sci; // custom script for setting figure properties
+title('Root locus for DC servo pole assignment','fontsize',3);
+//------------------------------------------------------------------
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Working_Examples/3432/CH7/EX7.30/Ex7_30_f0.pdf b/Working_Examples/3432/CH7/EX7.30/Ex7_30_f0.pdf Binary files differnew file mode 100755 index 0000000..65b7d85 --- /dev/null +++ b/Working_Examples/3432/CH7/EX7.30/Ex7_30_f0.pdf |