summaryrefslogtreecommitdiff
path: root/Working_Examples/83/CH6
diff options
context:
space:
mode:
authorSiddharth Agarwal2019-09-03 18:27:40 +0530
committerSiddharth Agarwal2019-09-03 18:27:40 +0530
commit8ac15bc5efafa2afc053c293152605b0e6ae60ff (patch)
treee1bc17aae137922b1ee990f17aae4a6cb15b7d87 /Working_Examples/83/CH6
parent52a477ec613900885e29c4a0b02806a415b4f83a (diff)
downloadXcos_block_examples-master.tar.gz
Xcos_block_examples-master.tar.bz2
Xcos_block_examples-master.zip
Xcos examples from textbooks and for blocksHEADmaster
Diffstat (limited to 'Working_Examples/83/CH6')
-rwxr-xr-xWorking_Examples/83/CH6/EX6.1/example_6_1.sce40
-rwxr-xr-xWorking_Examples/83/CH6/EX6.1/result_example_6_1.txt20
-rwxr-xr-xWorking_Examples/83/CH6/EX6.2/example_6_2.sce33
-rwxr-xr-xWorking_Examples/83/CH6/EX6.2/result_example_6_2.txt18
-rwxr-xr-xWorking_Examples/83/CH6/EX6.3/example_6_3.sce64
-rwxr-xr-xWorking_Examples/83/CH6/EX6.3/result_example_6_3.txt42
-rwxr-xr-xWorking_Examples/83/CH6/EX6.4/example_6_4.sce31
-rwxr-xr-xWorking_Examples/83/CH6/EX6.4/result_example_6_4.txt21
-rwxr-xr-xWorking_Examples/83/CH6/EX6.5/example_6_5.sce86
-rwxr-xr-xWorking_Examples/83/CH6/EX6.5/result_example_6_5.txt60
-rwxr-xr-xWorking_Examples/83/CH6/EX6.6/example_6_6.sce114
-rwxr-xr-xWorking_Examples/83/CH6/EX6.6/result_example_6_6.txt30
-rwxr-xr-xWorking_Examples/83/CH6/EX6.7/example_6_7.sce45
-rwxr-xr-xWorking_Examples/83/CH6/EX6.7/result_example_6_7.txt20
-rwxr-xr-xWorking_Examples/83/CH6/EX6.8/example_6_8.sce122
-rwxr-xr-xWorking_Examples/83/CH6/EX6.8/result_example_6_8.txt42
16 files changed, 788 insertions, 0 deletions
diff --git a/Working_Examples/83/CH6/EX6.1/example_6_1.sce b/Working_Examples/83/CH6/EX6.1/example_6_1.sce
new file mode 100755
index 0000000..cb0ae70
--- /dev/null
+++ b/Working_Examples/83/CH6/EX6.1/example_6_1.sce
@@ -0,0 +1,40 @@
+//Chapter 6
+//Example 6.1
+//page 195
+//To Ybus using singular transformation
+
+clear;clc;
+printf('Let us solve this problem by giving values given in the table 6.1 instead of keeping it in variables');
+
+y10=1;y20=1;y30=1;y40=1;
+y34=2-%i*6;y23=0.666-%i*2;
+y12=2-%i*6;y24=1-%i*3;
+y13=1-%i*3;
+
+Y=[y10 0 0 0 0 0 0 0 0;
+ 0 y20 0 0 0 0 0 0 0;
+ 0 0 y30 0 0 0 0 0 0;
+ 0 0 0 y40 0 0 0 0 0;
+ 0 0 0 0 y34 0 0 0 0;
+ 0 0 0 0 0 y23 0 0 0;
+ 0 0 0 0 0 0 y12 0 0;
+ 0 0 0 0 0 0 0 y24 0;
+ 0 0 0 0 0 0 0 0 y13];
+A=[1 0 0 0;
+ 0 1 0 0;
+ 0 0 1 0;
+ 0 0 0 1;
+ 0 0 1 -1;
+ 0 -1 1 0;
+ 1 -1 0 0;
+ 0 -1 0 1;
+ -1 0 1 0];
+printf('\n\n Ybus matrix using singular transformation for the system of fig.6.2 is \n Ybus= ');
+Y=A'*Y*A;
+disp(Y);
+// for verification let us calculate as given in the text book
+printf('\n\n For verification,calculating Ybus substituting as given in the text book\n Ybus(verifiaction)=');
+Yveri=[(y10+y12+y13) -y12 -y13 0;-y12 (y20+y12+y23+y24) -y23 -y24;-y13 -y23 (y30+y13+y23+y34) -y34;0 -y24 -y34 (y40+y24+y34)];
+disp(Yveri);
+
+
diff --git a/Working_Examples/83/CH6/EX6.1/result_example_6_1.txt b/Working_Examples/83/CH6/EX6.1/result_example_6_1.txt
new file mode 100755
index 0000000..a96fc56
--- /dev/null
+++ b/Working_Examples/83/CH6/EX6.1/result_example_6_1.txt
@@ -0,0 +1,20 @@
+
+-->exec('/home/samyak/scilab_working_directory/chapter_6/ex_1/example_6_1.sce', -1)
+Let us solve this problem by giving values given in the table 6.1 instead of keeping it in variables
+
+ Ybus matrix using singular transformation for the system of fig.6.2 is
+ Ybus=
+ 4. - 9.i - 2. + 6.i - 1. + 3.i 0
+ - 2. + 6.i 4.666 - 11.i - 0.666 + 2.i - 1. + 3.i
+ - 1. + 3.i - 0.666 + 2.i 4.666 - 11.i - 2. + 6.i
+ 0 - 1. + 3.i - 2. + 6.i 4. - 9.i
+
+
+ For verification,calculating Ybus substituting as given in the text book
+ Ybus(verifiaction)=
+ 4. - 9.i - 2. + 6.i - 1. + 3.i 0
+ - 2. + 6.i 4.666 - 11.i - 0.666 + 2.i - 1. + 3.i
+ - 1. + 3.i - 0.666 + 2.i 4.666 - 11.i - 2. + 6.i
+ 0 - 1. + 3.i - 2. + 6.i 4. - 9.i
+
+-->diary(0);
diff --git a/Working_Examples/83/CH6/EX6.2/example_6_2.sce b/Working_Examples/83/CH6/EX6.2/example_6_2.sce
new file mode 100755
index 0000000..208ebc4
--- /dev/null
+++ b/Working_Examples/83/CH6/EX6.2/example_6_2.sce
@@ -0,0 +1,33 @@
+//Chapter 6
+//Example 6.2
+//page 195
+//To Ybus of sample system
+clear;clc;
+
+y10=1;y20=1;y30=1;y40=1;
+y34=2-%i*6;y23=0.666-%i*2;
+y12=2-%i*6;y24=1-%i*3;
+y13=1-%i*3;
+
+//to form Ybus matrix
+Y11=y13;Y12=0;Y13=-y13;Y14=0;
+Y21=0;Y22=y23+y24;Y23=-y23;Y24=-y24;
+Y31=-y13;Y32=-y23;Y33=y13+y23+y34;Y34=-y34;
+Y41=0;Y42=-y24;Y43=-y34;Y44=y34+y24;
+
+//case(i) line shown dotted is not connected
+Ybus=[Y11 Y12 Y13 Y14;
+ Y21 Y22 Y23 Y24;
+ Y31 Y32 Y33 Y34;
+ Y41 Y42 Y43 Y44];
+printf('(i)Assuming that the line shown is not connected \n Ybus= ');disp(Ybus);
+//case(ii) line shown dotted is connected
+Y12=Y12-y12;Y21=Y12;
+Y11=Y11+y12;
+Y22=Y22+y12;
+
+Ybus=[Y11 Y12 Y13 Y14;
+ Y21 Y22 Y23 Y24;
+ Y31 Y32 Y33 Y34;
+ Y41 Y42 Y43 Y44];
+printf('\n\n(ii)Assuming that the line shown is connected \n Ybus= ');disp(Ybus); \ No newline at end of file
diff --git a/Working_Examples/83/CH6/EX6.2/result_example_6_2.txt b/Working_Examples/83/CH6/EX6.2/result_example_6_2.txt
new file mode 100755
index 0000000..3e4396f
--- /dev/null
+++ b/Working_Examples/83/CH6/EX6.2/result_example_6_2.txt
@@ -0,0 +1,18 @@
+
+-->exec('/home/samyak/scilab_working_directory/chapter_6/ex_2/example_6_2.sce', -1)
+(i)Assuming that the line shown is not connected
+ Ybus=
+ 1. - 3.i 0 - 1. + 3.i 0
+ 0 1.666 - 5.i - 0.666 + 2.i - 1. + 3.i
+ - 1. + 3.i - 0.666 + 2.i 3.666 - 11.i - 2. + 6.i
+ 0 - 1. + 3.i - 2. + 6.i 3. - 9.i
+
+
+(ii)Assuming that the line shown is connected
+ Ybus=
+ 3. - 9.i - 2. + 6.i - 1. + 3.i 0
+ - 2. + 6.i 3.666 - 11.i - 0.666 + 2.i - 1. + 3.i
+ - 1. + 3.i - 0.666 + 2.i 3.666 - 11.i - 2. + 6.i
+ 0 - 1. + 3.i - 2. + 6.i 3. - 9.i
+
+-->diary(0);
diff --git a/Working_Examples/83/CH6/EX6.3/example_6_3.sce b/Working_Examples/83/CH6/EX6.3/example_6_3.sce
new file mode 100755
index 0000000..a0d85a1
--- /dev/null
+++ b/Working_Examples/83/CH6/EX6.3/example_6_3.sce
@@ -0,0 +1,64 @@
+//Chapter 6
+//Example 6.3
+//page 201
+//To find an approximate load flow solution
+clear;clc;
+
+/////////////////////////////////////////////////////////////////////////////////
+//Realdemand Reactive demand Real generation Reactive generation Bus
+/////////////////////////////////////////////////////////////////////////////////
+ Pd1=1; Qd1=0.5; Pg1=0; Qg1=0;//initialization 1
+ Pd2=1; Qd2=0.4; Pg2=4; Qg2=0;//initialization 2
+ Pd3=2; Qd3=1; Pg3=0; Qg3=0;//initialization 3
+ Pd4=2; Qd4=1; Pg4=0; Qg4=0;//initialization 4
+
+Pg1=Pd1+Pd2+Pd3+Pd4-Pg2;
+
+//Ybus matrix from the network
+Ybus=[-21.667*%i 5*%i 6.667*%i 10*%i;
+ 5*%i -21.667*%i 10*%i 6.667*%i;
+ 6.667*%i 10*%i -16.667*%i 0;
+ 10*%i 6.667*%i 0 -16.667*%i];
+printf('Ybus matrix of the system is given by \nYbus=');disp(Ybus);
+//as given in the text book using approximate load flow equations and simplifying (ii),(iii),(iv)
+//delta matrix(x) is of the from A*x=B
+A=[-5 21.667 -10 -6.667;
+ -6.667 -10 16.667 0;
+ -10 -6.667 0 16.667
+ 1 0 0 0];
+
+B=[3; -2; -2;0];
+
+delta=inv(A)*B; //solving for delta
+printf('\nDelta of the system is given by \ndelta(rad)=');disp(delta);
+
+Q1=-5*cos(delta(2,1))-6.667*cos(delta(3,1))-10*cos(delta(4,1))+21.667;
+Q2=-5*cos(delta(2,1))-10*cos(delta(3,1)-delta(2,1))-6.667*cos(delta(4,1)-delta(2,1))+21.667;
+Q3=-6.667*cos(delta(3,1))-10*cos(delta(3,1)-delta(2,1))+16.667;
+Q4=-10*cos(delta(4,1))-6.667*cos(delta(4,1)-delta(2,1))+16.667;
+
+Q=[Q1;Q2;Q3;Q4];
+printf('\nInjected reactive power at the buses is given by \nQi(in pu)=');disp(Q);
+
+Qg1=Q1+Qd1;
+Qg2=Q2+Qd2;
+Qg3=Q3+Qd3;
+Qg4=Q4+Qd4;
+
+Qg=[Qg1;Qg2;Qg3;Qg4];
+printf('\n Reactive power generation at the four buses are \nQgi(in pu)=');disp(Qg);
+Qd=[Qd1;Qd2;Qd3;Qd4];
+Ql=sum(Qg)-sum(Qd);
+printf('\nReactive power losses are QL=%0.5f pu',Ql);
+
+printf('\n\nLine Flows are given as:\n');
+P13=(abs(Ybus(1,3)))*sin(delta(1,1)-delta(3,1));P31=-P13;printf('\nP13=-P31=%0.3f pu',P13);
+P12=(abs(Ybus(1,2)))*sin(delta(1,1)-delta(2,1));P21=-P12;printf('\nP12=-P21=%0.3f pu',P12);
+P14=(abs(Ybus(1,4)))*sin(delta(1,1)-delta(4,1));P41=-P14;printf('\nP14=-P41=%0.3f pu',P14);
+
+Q13=abs(Ybus(1,3))-(abs(Ybus(1,3)))*cos(delta(1,1)-delta(3,1));Q31=-Q13;printf('\n\nQ13=-Q31=%0.3f pu',Q13);
+Q12=abs(Ybus(1,2))-(abs(Ybus(1,2)))*cos(delta(1,1)-delta(2,1));Q21=-Q12;printf('\nQ12=-Q21=%0.3f pu',Q12);
+Q14=abs(Ybus(1,4))-(abs(Ybus(1,4)))*cos(delta(1,1)-delta(4,1));Q41=-Q14;printf('\nQ14=-Q41=%0.3f pu',Q14);
+
+
+ \ No newline at end of file
diff --git a/Working_Examples/83/CH6/EX6.3/result_example_6_3.txt b/Working_Examples/83/CH6/EX6.3/result_example_6_3.txt
new file mode 100755
index 0000000..ec1cc10
--- /dev/null
+++ b/Working_Examples/83/CH6/EX6.3/result_example_6_3.txt
@@ -0,0 +1,42 @@
+
+-->exec('/home/samyak/scilab_working_directory/chapter_6/ex_3/example_6_3.sce', -1)
+Ybus matrix of the system is given by
+Ybus=
+ - 21.667i 5.i 6.667i 10.i
+ 5.i - 21.667i 10.i 6.667i
+ 6.667i 10.i - 16.667i 0
+ 10.i 6.667i 0 - 16.667i
+
+Delta of the system is given by
+delta(rad)=
+ 0.
+ 0.0769217
+ - 0.0738455
+ - 0.0892280
+
+Injected reactive power at the buses is given by
+Qi(in pu)=
+ 0.0727367
+ 0.2200358
+ 0.1316085
+ 0.1315939
+
+ Reactive power generation at the four buses are
+Qgi(in pu)=
+ 0.5727367
+ 0.6200358
+ 1.1316085
+ 1.1315939
+
+Reactive power losses are QL=0.55597 pu
+
+Line Flows are given as:
+
+P13=-P31=0.492 pu
+P12=-P21=-0.384 pu
+P14=-P41=0.891 pu
+
+Q13=-Q31=0.018 pu
+Q12=-Q21=0.015 pu
+Q14=-Q41=0.040 pu
+-->diary(0);
diff --git a/Working_Examples/83/CH6/EX6.4/example_6_4.sce b/Working_Examples/83/CH6/EX6.4/example_6_4.sce
new file mode 100755
index 0000000..49b5188
--- /dev/null
+++ b/Working_Examples/83/CH6/EX6.4/example_6_4.sce
@@ -0,0 +1,31 @@
+//Chapter 6
+//Example 6.4
+//page 209
+//To find bus voltages using GS iterations
+clear;clc;
+
+//Ybus matrix from the network
+Ybus=[3-9*%i -2+6*%i -1+3*%i 0;
+ -2+6*%i 3.666-11*%i -0.666+2*%i -1+3*%i
+ -1+3*%i -0.666+2*%i 3.666-11*%i -2+6*%i
+ 0 -1+3*%i -2+6*%i 3-9*%i]
+
+//////////////////////////////////////////////////////
+//Pi Qi Vi Remarks Bus no//
+P1=0; Q1=0; V1=1.04; //Slack bus 1
+P2=0.5; Q2=-0.2; V2=1; //PQbus 2
+P3=-1.0; Q3=0.5; V3=1; //PQbus 3
+P4=0.3; Q4=-0.1; V4=1; //PQbus 4
+/////////////////////////////////////////////////////
+
+n=1;
+for i=1:n
+ V2=(1/Ybus(2,2))*(((P2-%i*Q2)/conj(V2))-Ybus(2,1)*V1-Ybus(2,3)*V3-Ybus(2,4)*V4);
+ V3=(1/Ybus(3,3))*(((P3-%i*Q3)/conj(V3))-Ybus(3,1)*V1-Ybus(3,2)*V2-Ybus(3,4)*V4);
+ V4=(1/Ybus(4,4))*(((P4-%i*Q4)/conj(V4))-Ybus(4,1)*V1-Ybus(4,2)*V2-Ybus(4,3)*V3);
+end
+
+printf('\nAt the end of iteration %d the voltages at the buses are:\n\nV1=',n);disp(V1);printf('pu');
+printf('\n\n\nV2=');disp(V2);printf('pu');
+printf('\n\n\nV3=');disp(V3);printf('pu');
+printf('\n\n\nV4=');disp(V4);printf('pu');
diff --git a/Working_Examples/83/CH6/EX6.4/result_example_6_4.txt b/Working_Examples/83/CH6/EX6.4/result_example_6_4.txt
new file mode 100755
index 0000000..4198a53
--- /dev/null
+++ b/Working_Examples/83/CH6/EX6.4/result_example_6_4.txt
@@ -0,0 +1,21 @@
+
+At the end of iteration 1 the voltages at the buses are:
+
+V1=
+ 1.04
+pu
+
+
+V2=
+ 1.0190887 + 0.0463655i
+pu
+
+
+V3=
+ 1.0280236 - 0.0870264i
+pu
+
+
+V4=
+ 1.0250453 - 0.0092291i
+pu
diff --git a/Working_Examples/83/CH6/EX6.5/example_6_5.sce b/Working_Examples/83/CH6/EX6.5/example_6_5.sce
new file mode 100755
index 0000000..8e7eb91
--- /dev/null
+++ b/Working_Examples/83/CH6/EX6.5/example_6_5.sce
@@ -0,0 +1,86 @@
+//Chapter 6
+//Example 6.5
+//page 210
+//To find bus voltages and Reactive power injected using GS iterations
+clear;clc;
+
+//Ybus matrix from the network
+Ybus=[3-9*%i -2+6*%i -1+3*%i 0;
+ -2+6*%i 3.666-11*%i -0.666+2*%i -1+3*%i
+ -1+3*%i -0.666+2*%i 3.666-11*%i -2+6*%i
+ 0 -1+3*%i -2+6*%i 3-9*%i]
+
+//Case(i)
+
+//////////////////////////////////////////////////////
+//Pi Qi Vi Remarks Bus no//
+P1=0; Q1=0; V1=1.04; //Slack bus 1
+P2=0.5; Q2=0.2; V2=1.04; //PVbus 2
+P3=-1.0; Q3=0.5; V3=1; //PQbus 3
+P4=0.3; Q4=-0.1; V4=1; //PQbus 4
+/////////////////////////////////////////////////////
+printf('\nCase(i) When 0.2<Q2<1 pu and running for 1 iteration,we get \n\n');
+Q2min=0.2;Q2max=1;
+n=1;
+
+for i=1:n
+ if Q2<Q2min then
+ Q2=Q2min;
+ V2=(1/Ybus(2,2))*(((P2-%i*Q2)/conj(V2))-Ybus(2,1)*V1-Ybus(2,3)*V3-Ybus(2,4)*V4);
+ elseif Q2>Q2max then
+ Q2=Q2max;
+ V2=(1/Ybus(2,2))*(((P2-%i*Q2)/conj(V2))-Ybus(2,1)*V1-Ybus(2,3)*V3-Ybus(2,4)*V4);
+ else
+ Q2=-imag(conj(V2)*Ybus(2,1)*V1+conj(V2)*(Ybus(2,2)*V2+Ybus(2,3)*V3+Ybus(2,4)*V4));
+ [mag,delta2]=polar((1/Ybus(2,2))*(((P2-%i*Q2)/(conj(V2)))-Ybus(2,1)*V1-Ybus(2,3)*V3-Ybus(2,4)*V4));
+ V2=abs(V2)*(cos(delta2)+%i*sin(delta2));
+ end
+ V3=(1/Ybus(3,3))*(((P3-%i*Q3)/conj(V3))-Ybus(3,1)*V1-Ybus(3,2)*V2-Ybus(3,4)*V4);
+ V4=(1/Ybus(4,4))*(((P4-%i*Q4)/conj(V4))-Ybus(4,1)*V1-Ybus(4,2)*V2-Ybus(4,3)*V3);
+end
+
+printf('Q2=');disp(Q2);printf('pu');
+printf('\n\n\ndelta2=');disp(abs(delta2));printf('rad');
+printf('\n\n\nV1=');disp(V1);printf('pu');
+printf('\n\n\nV2=');disp(V2);printf('pu');
+printf('\n\n\nV3=');disp(V3);printf('pu');
+printf('\n\n\nV4=');disp(V4);printf('pu');
+
+
+// case(ii)
+
+printf('\n\n\nCase(ii) When 0.25<Q2<1 pu and running for 1 iteration,we get \n\n');
+
+//////////////////////////////////////////////////////
+//Pi Qi Vi Remarks Bus no//
+P1=0; Q1=0; V1=1.04; //Slack bus 1
+P2=0.5; V2=1.04; //PVbus 2
+P3=-1.0; Q3=0.5; V3=1; //PQbus 3
+P4=0.3; Q4=-0.1; V4=1; //PQbus 4
+/////////////////////////////////////////////////////
+
+Q2min=0.25;Q2max=1;
+n=1;
+
+for i=1:n
+ if Q2<Q2min then
+ Q2=Q2min;
+ V2=(1/Ybus(2,2))*(((P2-%i*Q2)/conj(V2))-Ybus(2,1)*V1-Ybus(2,3)*V3-Ybus(2,4)*V4);
+ elseif Q2>Q2max then
+ Q2=Q2max;
+ V2=(1/Ybus(2,2))*(((P2-%i*Q2)/conj(V2))-Ybus(2,1)*V1-Ybus(2,3)*V3-Ybus(2,4)*V4);
+ else
+ Q2=-imag(conj(V2)*Ybus(2,1)*V1+conj(V2)*(Ybus(2,2)*V2+Ybus(2,3)*V3+Ybus(2,4)*V4));
+ [mag,delta2]=polar((1/Ybus(2,2))*(((P2-%i*Q2)/(conj(V2)))-Ybus(2,1)*V1-Ybus(2,3)*V3-Ybus(2,4)*V4));
+ V2=abs(V2)*(cos(delta2)+%i*sin(delta2));
+ end
+ V3=(1/Ybus(3,3))*(((P3-%i*Q3)/conj(V3))-Ybus(3,1)*V1-Ybus(3,2)*V2-Ybus(3,4)*V4);
+ V4=(1/Ybus(4,4))*(((P4-%i*Q4)/conj(V4))-Ybus(4,1)*V1-Ybus(4,2)*V2-Ybus(4,3)*V3);
+end
+
+printf('Q2=');disp(Q2);printf('pu');
+printf('\n\n\nV1=');disp(V1);printf('pu');
+printf('\n\n\nV2=');disp(V2);printf('pu');
+printf('\n\n\nV3=');disp(V3);printf('pu');
+printf('\n\n\nV4=');disp(V4);printf('pu');
+
diff --git a/Working_Examples/83/CH6/EX6.5/result_example_6_5.txt b/Working_Examples/83/CH6/EX6.5/result_example_6_5.txt
new file mode 100755
index 0000000..b52c393
--- /dev/null
+++ b/Working_Examples/83/CH6/EX6.5/result_example_6_5.txt
@@ -0,0 +1,60 @@
+
+
+
+Case(i) When 0.2<Q2<1 pu and running for 1 iteration,we get
+
+Q2=
+ 0.208
+pu
+
+
+delta2=
+ 0.0322201
+rad
+
+
+V1=
+ 1.04
+pu
+
+
+V2=
+ 1.0394602 + 0.0335032i
+pu
+
+
+V3=
+ 1.0317266 - 0.0893657i
+pu
+
+
+V4=
+ 1.0343045 - 0.0150761i
+pu
+
+
+Case(ii) When 0.25<Q2<1 pu and running for 1 iteration,we get
+
+Q2=
+ 0.25
+pu
+
+
+V1=
+ 1.04
+pu
+
+
+V2=
+ 1.0545971 + 0.0327833i
+pu
+
+
+V3=
+ 1.0344785 - 0.0894973i
+pu
+
+
+V4=
+ 1.0411847 - 0.0154037i
+pu
diff --git a/Working_Examples/83/CH6/EX6.6/example_6_6.sce b/Working_Examples/83/CH6/EX6.6/example_6_6.sce
new file mode 100755
index 0000000..0058084
--- /dev/null
+++ b/Working_Examples/83/CH6/EX6.6/example_6_6.sce
@@ -0,0 +1,114 @@
+//Chapter 6
+//Example 6.6
+//page 218
+//To find load flow solution using the NR method
+clear;clc;
+
+/////////////////////////////////////////////////////////////////////////
+//Pd Qd Pg Qg V Bus Type/////
+/////////////////////////////////////////////////////////////////////////
+Pd1=2.0; Qd1=1.0; Pg1=0; Qg1=0; V1=1.04; //1 slack bus
+Pd2=0; Qd2=0; Pg2=0.5; Qg2=1; V2=1; //2 PQ bus
+Pd3=1.5; Qd3=0.6; Pg3=0.0; Qg3=0; V3=1.04; //3 PV bus
+/////////////////////////////////////////////////////////////////////////
+[V1_mag,V1_ang]=polar(V1);
+[V2_mag,V2_ang]=polar(V2);
+[V3_mag,V3_ang]=polar(V3);
+y_series=1/(0.02+%i*0.08);
+y_self=2*y_series;
+y_off=-1*y_series;
+Ybus=[y_self y_off y_off;y_off y_self y_off;y_off y_off y_self];
+
+[y_bus_mag_21,y_bus_ang_21]=polar(Ybus(2,1));
+[y_bus_mag_22,y_bus_ang_22]=polar(Ybus(2,2));
+[y_bus_mag_23,y_bus_ang_23]=polar(Ybus(2,3));
+[y_bus_mag_31,y_bus_ang_31]=polar(Ybus(3,1));
+[y_bus_mag_32,y_bus_ang_32]=polar(Ybus(3,2));
+[y_bus_mag_33,y_bus_ang_33]=polar(Ybus(3,3));
+[y_bus_mag_11,y_bus_ang_11]=polar(Ybus(1,1));
+
+//direct computer solution has been found as below by running for 3 iterations
+
+n=3;
+for i=1:n
+//from eq.6.27 and 6.28
+P2=V2_mag*V1_mag*y_bus_mag_21*cos(y_bus_ang_21+V1_ang-V2_ang)+(V2_mag^2)*y_bus_mag_22*cos(y_bus_ang_22)+V2_mag*V3_mag*y_bus_mag_23*cos(y_bus_ang_23+V3_ang-V2_ang);
+
+P3=V3_mag*V1_mag*y_bus_mag_31*cos(y_bus_ang_31+V1_ang-V3_ang)+(V3_mag^2)*y_bus_mag_33*cos(y_bus_ang_33)+V2_mag*V3_mag*y_bus_mag_32*cos(y_bus_ang_32+V2_ang-V3_ang);
+
+Q2=-V2_mag*V1_mag*y_bus_mag_21*sin(y_bus_ang_21+V1_ang-V2_ang)-(V2_mag^2)*y_bus_mag_22*sin(y_bus_ang_22)-V2_mag*V3_mag*y_bus_mag_23*sin(y_bus_ang_23+V3_ang-V2_ang);
+
+P2=real(P2);
+P3=real(P3);
+Q2=real(Q2);
+
+delta_P2=(Pg2-Pd2)-(P2);
+delta_P3=(Pg3-Pd3)-(P3);
+delta_P2=(Pg2-Pd2)-(P2);
+delta_Q2=(Qg2-Qd2)-(Q2);
+
+//forming jacobian matrix by differentiating expressions of P2,P3,Q2
+j11=V2_mag*V1_mag*y_bus_mag_21*sin(y_bus_ang_21+V1_ang-V2_ang)+V2_mag*V3_mag*y_bus_mag_23*sin(y_bus_ang_23+V3_ang-V2_ang);
+j12=-V2_mag*V3_mag*y_bus_mag_23*sin(y_bus_ang_23+V3_ang-V2_ang);
+j13=V1_mag*y_bus_mag_21*cos(y_bus_ang_21+V1_ang-V2_ang)+(V2_mag*2)*y_bus_mag_22*cos(y_bus_ang_22)+V3_mag*y_bus_mag_23*cos(y_bus_ang_23+V3_ang-V2_ang);
+
+j21=-V2_mag*V3_mag*y_bus_mag_32*sin(y_bus_ang_32+V2_ang-V3_ang);
+j22=V3_mag*V1_mag*y_bus_mag_31*sin(y_bus_ang_31+V1_ang-V3_ang)+V2_mag*V3_mag*y_bus_mag_32*sin(y_bus_ang_32+V2_ang-V3_ang);
+j23=V3_mag*y_bus_mag_32*cos(y_bus_ang_32+V2_ang-V3_ang);
+
+j31=V2_mag*V1_mag*y_bus_mag_21*cos(y_bus_ang_21+V1_ang-V2_ang)+V2_mag*V3_mag*y_bus_mag_23*cos(y_bus_ang_23+V3_ang-V2_ang);
+j32=-V2_mag*V3_mag*y_bus_mag_23*cos(y_bus_ang_23+V3_ang-V2_ang);
+j33=-V1_mag*y_bus_mag_21*sin(y_bus_ang_21+V1_ang-V2_ang)-(V2_mag*2)*y_bus_mag_22*sin(y_bus_ang_22)-V3_mag*y_bus_mag_23*sin(y_bus_ang_23+V3_ang-V2_ang);
+
+J=[j11 j12 j13;j21 j22 j23;j31 j32 j33];
+J=real(J);
+
+//power residuals
+PR=[delta_P2;delta_P3;delta_Q2];
+
+//changes in variables
+ch_var=inv(J)*PR;
+
+V2_ang=V2_ang+ch_var(1,1);
+V3_ang=V3_ang+ch_var(2,1);
+V2_mag=V2_mag+ch_var(3,1);
+
+P1=(V1_mag^2)*y_bus_mag_11*cos(y_bus_ang_11)+V1_mag*V2_mag*y_bus_mag_21*cos(y_bus_ang_21+V2_ang-V1_ang)+V1_mag*V3_mag*y_bus_mag_31*cos(y_bus_ang_31+V3_ang-V1_ang);
+Q1=-V1_mag^2*y_bus_mag_11*sin(y_bus_ang_11)-V1_mag*V2_mag*y_bus_mag_21*sin(y_bus_ang_21+V2_ang-V1_ang)-V1_mag*V3_mag*y_bus_mag_31*sin(y_bus_ang_31+V3_ang-V1_ang);
+
+Q3=-V3_mag*V1_mag*y_bus_mag_31*sin(y_bus_ang_31+V1_ang-V3_ang)-(V3_mag^2)*y_bus_mag_33*sin(y_bus_ang_33)-V2_mag*V3_mag*y_bus_mag_32*sin(y_bus_ang_32+V2_ang-V3_ang);
+Qg3=Q3+Qd3;
+
+end
+
+S1=real(P1)+%i*real(Q1);
+S2=P2+%i*Q2;
+S3=P3+%i*Q3;
+
+printf('\nThe final results are given below:\n');
+printf('V2=%0.3f @ %0.3f rad\n',V2_mag,V2_ang);
+printf('V3=%0.3f @ %0.3f rad\n',V3_mag,V3_ang);
+printf('Qg3=%0.2f pu(with in limits)\n',Qg3);
+printf('\nS1=');disp(S1);printf('pu');
+printf('\n\nS2=');disp(S2);printf("pu");
+printf('\n\nS3=');disp(S3);printf("pu");
+printf('\n\nTransmission losses=%0.3f pu\n',(real(P1)+P2+P3));
+
+//Line Flows
+
+//V_mag=[V1_mag V2_mag V3_mag];
+//V_ang=[V1_ang V2_ang V3_ang];
+v1=V1_mag*(cos(V1_ang)+%i*sin(V1_ang));
+v2=V2_mag*(cos(V2_ang)+%i*sin(V2_ang));
+v3=V3_mag*(cos(V3_ang)+%i*sin(V3_ang));
+V=[v1 v2 v3];
+for i=1:3
+ for j=1:3
+ s(i,j)=conj(V(i))*(V(i)-V(j))*(2.941-%i*11.764)+conj(V(i))*V(i)*(%i*0.01);
+ s(j,i)=conj(V(j))*(V(j)-V(i))*(2.941-%i*11.764)+conj(V(j))*V(j)*(%i*0.01);
+ end
+end
+P=real(s);
+Q=-imag(s);
+printf('\nLine Flows\nThe following matrix shows the real part of line flows(in pu)');disp(P);
+printf('\nThe following matrix shows the imaginary part of line flows(in pu)');disp(Q); \ No newline at end of file
diff --git a/Working_Examples/83/CH6/EX6.6/result_example_6_6.txt b/Working_Examples/83/CH6/EX6.6/result_example_6_6.txt
new file mode 100755
index 0000000..368084d
--- /dev/null
+++ b/Working_Examples/83/CH6/EX6.6/result_example_6_6.txt
@@ -0,0 +1,30 @@
+ The final results are given below:
+V2=1.081 @ -0.024 rad
+V3=1.040 @ -0.066 rad
+Qg3=0.48 pu(with in limits)
+
+S1=
+ 1.0311806 - 0.7581336i
+pu
+
+S2=
+ 0.5004595 + 1.0012862i
+pu
+
+S3=
+ - 1.5000616 - 0.1171441i
+pu
+
+Transmission losses=0.032 pu
+
+Line Flows
+The following matrix shows the real part of line flows(in pu)
+ 0. 0.1910725 0.8400462
+ - 0.1842388 0. 0.6842088
+ - 0.8263909 - 0.6735191 0.
+
+The following matrix shows the imaginary part of line flows(in pu)
+ - 0.010816 - 0.5879101 - 0.1918100
+ 0.5927428 - 0.0116862 0.3838248
+ 0.2247993 - 0.3635684 - 0.010816
+
diff --git a/Working_Examples/83/CH6/EX6.7/example_6_7.sce b/Working_Examples/83/CH6/EX6.7/example_6_7.sce
new file mode 100755
index 0000000..46c8605
--- /dev/null
+++ b/Working_Examples/83/CH6/EX6.7/example_6_7.sce
@@ -0,0 +1,45 @@
+//Chapter 6
+//Example 6.7
+//page 234
+//To find modified Ybus after including regulating transformer
+clear;clc;
+
+y34=2-%i*6;y23=0.666-%i*2;
+y12=2-%i*6;y24=1-%i*3;
+y13=1-%i*3;
+
+//case(i) when a=1/1.04;
+a=1/1.04;
+//to form Ybus matrix
+Y11=y13+y12;Y12=-y12;Y13=-y13;Y14=0;
+Y21=-y12;Y22=y12+y23+y24;Y23=-y23;Y24=-y24;
+Y31=-y13;Y32=-y23;Y33=(a^2)*y34+y23+y13;Y34=-(a')*y34;
+Y41=0;Y42=-y24;Y43=-a'*y34;Y44=y34+y24;
+
+
+Ybus=[Y11 Y12 Y13 Y14;
+ Y21 Y22 Y23 Y24;
+ Y31 Y32 Y33 Y34;
+ Y41 Y42 Y43 Y44];
+printf('Case(i) When a=1/1.04');
+printf('\nYbus=');disp(Ybus);
+printf('\nObserve the changes in elements between bus 3&4 when compared with the result of example_6.2');
+
+//case(ii) when a=e^(-j3)
+
+a=cosd(3)-%i*sind(3);
+//to form Ybus matrix
+Y11=y13+y12;Y12=-y12;Y13=-y13;Y14=0;
+Y21=-y12;Y22=y12+y23+y24;Y23=-y23;Y24=-y24;
+Y31=-y13;Y32=-y23;Y33=(abs(a)^2)*y34+y23+y13;Y34=(a')*(-y34);
+Y41=0;Y42=-y24;Y43=a*(-y34);Y44=y34+y24;
+
+
+Ybus=[Y11 Y12 Y13 Y14;
+ Y21 Y22 Y23 Y24;
+ Y31 Y32 Y33 Y34;
+ Y41 Y42 Y43 Y44];
+printf('\n\nCase(ii) When a=e^(-j3)');
+printf('\nYbus=');disp(Ybus);
+printf('\nObserve the changes in elements between bus 3&4 when compared with the result of example_6.2');
+
diff --git a/Working_Examples/83/CH6/EX6.7/result_example_6_7.txt b/Working_Examples/83/CH6/EX6.7/result_example_6_7.txt
new file mode 100755
index 0000000..3d2a478
--- /dev/null
+++ b/Working_Examples/83/CH6/EX6.7/result_example_6_7.txt
@@ -0,0 +1,20 @@
+
+-->exec('/home/samyak/scilab_working_directory/chapter_6/ex_7/example_6_7.sce', -1)
+Case(i) When a=1/1.04
+Ybus=
+ 3. - 9.i - 2. + 6.i - 1. + 3.i 0
+ - 2. + 6.i 3.666 - 11.i - 0.666 + 2.i - 1. + 3.i
+ - 1. + 3.i - 0.666 + 2.i 3.5151124 - 10.547337i - 1.9230769 + 5.7692308i
+ 0 - 1. + 3.i - 1.9230769 + 5.7692308i 3. - 9.i
+
+Observe the changes in elements between bus 3&4 when compared with the result of example_6.2
+
+Case(ii) When a=e^(-j3)
+Ybus=
+ 3. - 9.i - 2. + 6.i - 1. + 3.i 0
+ - 2. + 6.i 3.666 - 11.i - 0.666 + 2.i - 1. + 3.i
+ - 1. + 3.i - 0.666 + 2.i 3.666 - 11.i - 2.3112748 + 5.8871053i
+ 0 - 1. + 3.i - 1.6832433 + 6.0964491i 3. - 9.i
+
+Observe the changes in elements between bus 3&4 when compared with the result of example_6.2
+-->diary(0);
diff --git a/Working_Examples/83/CH6/EX6.8/example_6_8.sce b/Working_Examples/83/CH6/EX6.8/example_6_8.sce
new file mode 100755
index 0000000..23a8c85
--- /dev/null
+++ b/Working_Examples/83/CH6/EX6.8/example_6_8.sce
@@ -0,0 +1,122 @@
+//Chapter 6
+//Example 6.8
+//page 226
+//To find load flow solution using the decoupled NR method and FDLF method
+clear;clc;
+
+/////////////////////////////////////////////////////////////////////////
+//Pd Qd Pg Qg V Bus Type/////
+/////////////////////////////////////////////////////////////////////////
+Pd1=2.0; Qd1=1.0; Pg1=0; Qg1=0; V1=1.04; //1 slack bus
+Pd2=0; Qd2=0; Pg2=0.5; Qg2=1; V2=1; //2 PQ bus
+Pd3=1.5; Qd3=0.6; Pg3=0.0; Qg3=0; V3=1.04; //3 PV bus
+/////////////////////////////////////////////////////////////////////////
+[V1_mag,V1_ang]=polar(V1);
+[V2_mag,V2_ang]=polar(V2);
+[V3_mag,V3_ang]=polar(V3);
+y_series=1/(0.02+%i*0.08);
+y_self=2*y_series;
+y_off=-1*y_series;
+Ybus=[y_self y_off y_off;y_off y_self y_off;y_off y_off y_self];
+
+[y_bus_mag_21,y_bus_ang_21]=polar(Ybus(2,1));
+[y_bus_mag_22,y_bus_ang_22]=polar(Ybus(2,2));
+[y_bus_mag_23,y_bus_ang_23]=polar(Ybus(2,3));
+[y_bus_mag_31,y_bus_ang_31]=polar(Ybus(3,1));
+[y_bus_mag_32,y_bus_ang_32]=polar(Ybus(3,2));
+[y_bus_mag_33,y_bus_ang_33]=polar(Ybus(3,3));
+[y_bus_mag_11,y_bus_ang_11]=polar(Ybus(1,1));
+
+//case(a) Decoupled NR method :
+printf('\ncase(a) Decoupled NR method :\n') ;
+
+H22=0.96+23.508;
+H23=-1.04*11.764;
+H33=25.89;
+L22=1+23.508;
+H=[H22 H23;H23 H33];
+delta_P=[0.73;-1.62];
+
+delta_V_ang=inv(H)*delta_P;
+delta_V2_ang=delta_V_ang(1,1);
+delta_V3_ang=delta_V_ang(2,1);
+printf('\ndelta_Angle_V2=');disp(real(delta_V2_ang));
+printf('\ndelta_Angle_V3=');disp(real(delta_V3_ang));
+V2_ang=V2_ang-delta_V2_ang;
+V3_ang=V3_ang-delta_V3_ang;
+
+Q2=-V2_mag*V1_mag*y_bus_mag_21*sin(y_bus_ang_21+V1_ang-V2_ang)-(V2_mag^2)*y_bus_mag_22*sin(y_bus_ang_22)-V2_mag*V3_mag*y_bus_mag_23*sin(y_bus_ang_23-V3_ang+V2_ang);
+
+printf('\nQ2=');disp(real(Q2));
+delta_Q2=(Qg2-Qd2)-(Q2);
+printf('\ndelta_Q2=');disp(real(delta_Q2));
+L=[L22];
+delta_v=inv(L)*delta_Q2;
+delta_V2=delta_v*V2_mag;
+
+printf('\ndelta_V2=%0.3f',delta_V2);
+V2_mag=V2_mag+delta_V2;
+printf('\n\nV2=%0.3f pu',V2_mag);
+
+Q3=-V3_mag*V1_mag*y_bus_mag_31*sin(y_bus_ang_31+V1_ang-V3_ang)-(V3_mag^2)*y_bus_mag_33*sin(y_bus_ang_33)-V2_mag*V3_mag*y_bus_mag_32*sin(y_bus_ang_32+V2_ang-V3_ang);
+
+printf('\n\nQ3=');disp(real(Q3));
+
+//case(b) FDLF method:
+
+printf('\n\n\ncase(b) FDLF method :\n') ;
+
+/////////////////////////////////////////////////////////////////////////
+//Pd Qd Pg Qg V Bus Type/////
+/////////////////////////////////////////////////////////////////////////
+Pd1=2.0; Qd1=1.0; Pg1=0; Qg1=0; V1=1.04; //1 slack bus
+Pd2=0; Qd2=0; Pg2=0.5; Qg2=1; V2=1; //2 PQ bus
+Pd3=1.5; Qd3=0.6; Pg3=0.0; Qg3=0; V3=1.04; //3 PV bus
+/////////////////////////////////////////////////////////////////////////
+[V1_mag,V1_ang]=polar(V1);
+[V2_mag,V2_ang]=polar(V2);
+[V3_mag,V3_ang]=polar(V3);
+y_series=1/(0.02+%i*0.08);
+y_self=2*y_series;
+y_off=-1*y_series;
+Ybus=[y_self y_off y_off;y_off y_self y_off;y_off y_off y_self];
+
+[y_bus_mag_21,y_bus_ang_21]=polar(Ybus(2,1));
+[y_bus_mag_22,y_bus_ang_22]=polar(Ybus(2,2));
+[y_bus_mag_23,y_bus_ang_23]=polar(Ybus(2,3));
+[y_bus_mag_31,y_bus_ang_31]=polar(Ybus(3,1));
+[y_bus_mag_32,y_bus_ang_32]=polar(Ybus(3,2));
+[y_bus_mag_33,y_bus_ang_33]=polar(Ybus(3,3));
+[y_bus_mag_11,y_bus_ang_11]=polar(Ybus(1,1));
+
+B22=-23.508;
+B23=11.764;
+B32=B23;
+B33=B22;
+
+B=[-B22 -B23;-B32 -B33];
+
+delta_P=[0.73;-1.557];
+
+delta_V_ang=inv(B)*delta_P;
+delta_V2_ang=delta_V_ang(1,1);
+delta_V3_ang=delta_V_ang(2,1);
+printf('\ndelta_Angle_V2=');disp(real(delta_V2_ang));
+printf('\ndelta_Angle_V3=');disp(real(delta_V3_ang));
+V2_ang=V2_ang-delta_V2_ang;
+V3_ang=V3_ang-delta_V3_ang;
+
+Q2=-V2_mag*V1_mag*y_bus_mag_21*sin(y_bus_ang_21+V1_ang-V2_ang)-(V2_mag^2)*y_bus_mag_22*sin(y_bus_ang_22)-V2_mag*V3_mag*y_bus_mag_23*sin(y_bus_ang_23-V3_ang+V2_ang);
+
+delta_Q2=(Qg2-Qd2)-(Q2);
+
+delta_v=inv([-B22])*delta_Q2;
+delta_V2=delta_v*V2_mag;
+
+printf('\ndelta_V2=%0.3f',delta_V2);
+V2_mag=V2_mag+delta_V2;
+printf('\n\nV2=%0.3f pu',V2_mag);
+
+Q3=-V3_mag*V1_mag*y_bus_mag_31*sin(y_bus_ang_31+V1_ang-V3_ang)-(V3_mag^2)*y_bus_mag_33*sin(y_bus_ang_33)-V2_mag*V3_mag*y_bus_mag_32*sin(y_bus_ang_32+V2_ang-V3_ang);
+
+printf('\n\nQ3=');disp(real(Q3));
diff --git a/Working_Examples/83/CH6/EX6.8/result_example_6_8.txt b/Working_Examples/83/CH6/EX6.8/result_example_6_8.txt
new file mode 100755
index 0000000..f8f965a
--- /dev/null
+++ b/Working_Examples/83/CH6/EX6.8/result_example_6_8.txt
@@ -0,0 +1,42 @@
+
+-->exec('/home/samyak/scilab_working_directory/chapter_6/ex_8/example_6_8.sce', -1)
+
+case(a) Decoupled NR method :
+
+delta_Angle_V2=
+ - 0.0019022
+
+delta_Angle_V3=
+ - 0.0634713
+
+Q2=
+ - 1.1119998
+
+delta_Q2=
+ 2.1119998
+
+delta_V2=0.086
+
+V2=1.086 pu
+
+Q3=
+ - 0.9203795
+
+
+
+case(b) FDLF method :
+
+delta_Angle_V2=
+ - 0.0027900
+
+delta_Angle_V3=
+ - 0.0676290
+
+delta_V2=0.090
+
+V2=1.090 pu
+
+Q3=
+ - 0.9890485
+
+-->diary(0);