summaryrefslogtreecommitdiff
path: root/3793/CH6/EX6.7/exp_6_7.sce
diff options
context:
space:
mode:
authorprashantsinalkar2017-10-10 12:27:19 +0530
committerprashantsinalkar2017-10-10 12:27:19 +0530
commit7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (patch)
treedbb9e3ddb5fc829e7c5c7e6be99b2c4ba356132c /3793/CH6/EX6.7/exp_6_7.sce
parentb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (diff)
downloadScilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.gz
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.bz2
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.zip
initial commit / add all books
Diffstat (limited to '3793/CH6/EX6.7/exp_6_7.sce')
-rw-r--r--3793/CH6/EX6.7/exp_6_7.sce67
1 files changed, 67 insertions, 0 deletions
diff --git a/3793/CH6/EX6.7/exp_6_7.sce b/3793/CH6/EX6.7/exp_6_7.sce
new file mode 100644
index 000000000..b97351b7c
--- /dev/null
+++ b/3793/CH6/EX6.7/exp_6_7.sce
@@ -0,0 +1,67 @@
+clear;
+clc;
+function [Zbus]=zeebus(nelemnt,ind,node);
+ if ind==1;
+ Zbus=input('Partial matrix Zbus');
+ ind=0;
+ else
+ end
+ if ind==0;
+ for l=1:nelemnt;
+ p=input('bus number p');
+ q=input('bus number q');
+ zb=input('impedence');
+ typee=input('type of bus');
+ if typee==1;
+ for k=1:q;
+ if k==q;
+ Zbus(k,k)=zb;
+ else
+ Zbus(k,q)=0;
+ end
+ end
+ end
+ if typee==2;
+ for k=1:q;
+ if k==q;
+ Zbus(q,q)=zb+Zbus(p,p);
+ else
+ if k==p;
+ Zbus(p,q)=Zbus(p,p);
+ Zbus(q,p)=Zbus(p,q);
+ else
+ Zbus(k,q)=0;
+ Zbus(q,k)=0;
+ end
+ end
+ end
+ end
+ if typee==3;
+ y=1/(zb+Zbus(p,p)-2*Zbus(p,q)+Zbus(q,q));
+ for k=1:node;
+ X(k,1)=Zbus(k,p)-Zbus(k,q);
+ Xt(1,k)=(k:1);
+ end
+ Zbus=Zbus-(-y)*X*X';
+ end
+ if typee==4;
+ y=1/(zb+Zbus(q,q));
+ for k=1:node;
+ X(k,1)=-Zbus(k,q);
+ Xt(1,k)=(k:1);
+ end
+ Zbus=Zbus-(-y)*X*X';
+ end
+ end
+ else
+
+
+ end
+
+endfunction
+nelemnt=7;
+ind=0;
+node=4;
+[Zbus]=zeebus(nelemnt,ind,node);
+mprintf("Zbus = \n");
+disp(Zbus);