diff options
Diffstat (limited to '3872/CH6')
24 files changed, 600 insertions, 0 deletions
diff --git a/3872/CH6/EX6.1/Ex6_1.jpg b/3872/CH6/EX6.1/Ex6_1.jpg Binary files differnew file mode 100644 index 000000000..d44900eee --- /dev/null +++ b/3872/CH6/EX6.1/Ex6_1.jpg diff --git a/3872/CH6/EX6.1/Ex6_1.sce b/3872/CH6/EX6.1/Ex6_1.sce new file mode 100644 index 000000000..644100431 --- /dev/null +++ b/3872/CH6/EX6.1/Ex6_1.sce @@ -0,0 +1,32 @@ +//Book - Power System: Analysis & Design 5th Edition
+//Authors - J. Duncan Glover, Mulukutla S. Sarma, and Thomas J. Overbye
+//Chapter - 6 ; Example 6.1
+//Scilab Version - 6.0.0 ; OS - Windows
+
+clc;
+clear;
+
+A=[10 5;2 9];
+y=[6;3];
+N=length(y); //Number of variables
+st=N-1; //Number of Gauss elimination steps
+
+//Gauss Elimination step:
+B=A;
+for i=1:st
+ for j=i+1:N
+ m=(B(j,i)/B(i,i));
+ A(j,i+1:N)=A(j,i+1:N)-m*(A(i,i+1:N));
+ A(i+1:N,i)=0;
+ y(j)=y(j)-m*y(i);
+ end
+ B=A;
+end
+
+//Back Substitution step
+x2=y(2)/A(2,2)
+x1=(y(1)-A(1,2)*x2)/A(1,1);
+disp(A,'The triangularized matrix using gauss elemination is:')
+disp(y,'and the corresponding y matrix is:')
+printf('The solution using back substitution is x1=%.4f and x2=%.4f',x1,x2)
+
diff --git a/3872/CH6/EX6.10/Ex6_10.jpg b/3872/CH6/EX6.10/Ex6_10.jpg Binary files differnew file mode 100644 index 000000000..366b85b05 --- /dev/null +++ b/3872/CH6/EX6.10/Ex6_10.jpg diff --git a/3872/CH6/EX6.10/Ex6_10.sce b/3872/CH6/EX6.10/Ex6_10.sce new file mode 100644 index 000000000..d0dfeb330 --- /dev/null +++ b/3872/CH6/EX6.10/Ex6_10.sce @@ -0,0 +1,98 @@ +//Book - Power System: Analysis & Design 5th Edition
+//Authors - J. Duncan Glover, Mulukutla S. Sarma, and Thomas J. Overbye
+//Chapter - 6 ; Example 6.10
+//Scilab Version - 6.0.0 ; OS - Windows
+
+clc;
+clear;
+
+linedata=[2 4 0.0090 0.10 1.72 //Entering line data from table 6.2 & 6.3
+ 2 5 0.0045 0.05 0.88
+ 4 5 0.00225 0.025 0.44
+ 1 5 0.00150 0.02 0.00
+ 3 4 0.00075 0.01 0.00];
+
+sb=linedata(:,1) //Starting bus number of all the lines stored in variable sb
+eb=linedata(:,2) //Ending bus number of all the lines stored in variable eb
+lz=linedata(:,3)+linedata(:,4)*%i; //lineimpedance=R+jX
+sa=linedata(:,5)*%i; //shunt admittance=jB since conductsnce G=0 for all lines
+nb=max(max(sb,eb));
+ybus=zeros(nb,nb);
+for i=1:length(sb)
+ m=sb(i);
+ n=eb(i);
+ ybus(m,m)=ybus(m,m)+1/lz(i)+sa(i)/2;
+ ybus(n,n)=ybus(n,n)+1/lz(i)+sa(i)/2;
+ ybus(m,n)=-1/lz(i);
+ ybus(n,m)=ybus(m,n);
+end
+y=ybus;
+//enter busdata in the order type (1.slack,2.pv,3.pq),PG,QG,PL,QL,vmag,del,Qmin and Qmax.
+//Data is taken from table 6.1
+busdata=[1 0 0 0 0 1 0 0 0
+ 3 0 0 8 2.8 1 0 0 0
+ 2 5.2 0 0.8 0.4 1.05 0 4 -2.8
+ 3 0 0 0 0 1 0 0 0
+ 3 0 0 0 0 1 0 0 0]
+
+typ=busdata(:,1) // type of all buses in the power system is stored in typ variable
+qmin=busdata(:,8) // minmum limit of Q for all the buses is stored in the variable qmin
+qmax=busdata(:,9) // maximum limit of Q for all the buses is stored in the variable qmax
+p=busdata(:,2)-busdata(:,4) // real power of all the buses are calculated and is stored in the variable p
+q=busdata(:,3)-busdata(:,5) // reactive power of all the buss are calculated and is stored in the variable q
+v=busdata(:,6).*(cosd(busdata(:,7))+%i*sind(busdata(:,7)));
+alpha=1; //Acceleration factor is assumed as 1 since it is not given in the question
+tol=1e-4; //Tolerance value for Gauss Seidal Load flow
+iter=0;
+err=1;
+vn(1)=v(1);
+vold=v(1);
+while abs(err)>tol
+ for i=2:nb
+ sumyv=0;
+ for j=1:nb
+ sumyv=sumyv+y(i,j)*v(j);
+ end
+ if typ(i)==2
+ q(i)=-imag(conj(v(i)*sumyv));
+ if q(i)<qmin(i) |q(n)>qmax(i)
+ vn(i)=(1/y(i,i))*(((p(i)-%i*q(i))/(conj(v(i))))-(sumyv-y(i,i)*v(i)));
+ vold(i)=v(i);
+ v(i)=vn(i);
+ typ(i)=3
+ if q(i)<qmin(i)
+ q(i)=qmin(i);
+ else
+ q(i)=qmax(i);
+ end
+ else
+ vn(i)=(1/y(i,i))*(((p(i)-%i*q(i))/(conj(v(i))))-(sumyv-y(i,i)*v(i)));
+ ang=atan(imag(vn(i)),real(vn(i)));
+ vn(i)=abs(v(i))*(cos(ang)+%i*sin(ang));
+ vold(i)=v(i);
+ v(i)=vn(i);
+ end
+ elseif typ(i)==3
+ vn(i)=(1/y(i,i))*(((p(i)-%i*q(i))/(conj(v(i))))-(sumyv-y(i,i)*v(i)));
+ vn(i)=(1/y(i,i))*(((p(i)-%i*q(i))/(conj(vn(i))))-(sumyv-y(i,i)*v(i)));
+ vold(i)=v(i);
+ v(i)=vn(i);
+ end
+ end
+err=max(abs(abs(v)-abs(vold)));
+
+iter=iter+1;
+for i=2:nb
+ if err>tol &typ(i)==3
+ v(i)=vold(i)+alpha*(v(i)-vold(i));
+ end
+end
+if iter==1
+ printf('Voltage of bus 2 at the end of first iteration in pu is given by:\n')
+ printf('Voltage magnitude=%.4f , angle=%.4f degrees\n\n',abs(v(2)),atand(imag(v(2)),real(v(2))))
+end
+end
+printf('The GS load flow converged in %d iterations \n',iter);
+nn=1:nb;
+res=[nn' abs(v) (atan(imag(v),real(v)))*(180/%pi)]
+disp(res,'The final voltages in the order of bus no,voltage mag,voltage angle is:');
diff --git a/3872/CH6/EX6.11/Ex6_11.jpg b/3872/CH6/EX6.11/Ex6_11.jpg Binary files differnew file mode 100644 index 000000000..8f3e16d03 --- /dev/null +++ b/3872/CH6/EX6.11/Ex6_11.jpg diff --git a/3872/CH6/EX6.11/Ex6_11.sce b/3872/CH6/EX6.11/Ex6_11.sce new file mode 100644 index 000000000..950f29af0 --- /dev/null +++ b/3872/CH6/EX6.11/Ex6_11.sce @@ -0,0 +1,152 @@ +//Book - Power System: Analysis & Design 5th Edition
+//Authors - J. Duncan Glover, Mulukutla S. Sarma, and Thomas J. Overbye
+//Chapter - 6 ; Example 6.11
+//Scilab Version - 6.0.0 ; OS - Windows
+
+clear;
+clc;
+linedata=[2 4 0.0090 0.10 1.72 //Entering line data from table 6.2 & 6.3
+ 2 5 0.0045 0.05 0.88
+ 4 5 0.00225 0.025 0.44
+ 1 5 0.00150 0.02 0.00
+ 3 4 0.00075 0.01 0.00];
+//enter busdata in the order type (1.slack,2.pv,3.pq),Pi,Qi,PL,QL,vmag,del,Qmin and Qmax.
+//Data is taken from table 6.1
+Busdata=[1 0 0 0 0 1 0 0 0
+ 3 0 0 8 2.8 1 0 0 0
+ 2 5.2 0 0.8 0.4 1.05 0 4 -2.8
+ 3 0 0 0 0 1 0 0 0
+ 3 0 0 0 0 1 0 0 0]
+npv=1; //Number of generator or PV buses in the system
+
+rem=Busdata(:,1);
+Psp=Busdata(:,2)-Busdata(:,4);
+Qsp=Busdata(:,3)-Busdata(:,5);
+vsp=Busdata(:,6);
+
+//Determination of bus admittance matrix:
+sb=linedata(:,1) //Starting bus number of all the lines stored in variable sb
+eb=linedata(:,2) //Ending bus number of all the lines stored in variable eb
+lz=linedata(:,3)+linedata(:,4)*%i; //lineimpedance=R+jX
+sa=linedata(:,5)*%i; //shunt admittance=jB since conductsnce G=0 for all lines
+nb=max(max(sb,eb)); //Number of buses in the system
+ybus=zeros(nb,nb);
+for i=1:length(sb)
+ m=sb(i);
+ n=eb(i);
+ ybus(m,m)=ybus(m,m)+1/lz(i)+sa(i)/2;
+ ybus(n,n)=ybus(n,n)+1/lz(i)+sa(i)/2;
+ ybus(m,n)=-1/lz(i);
+ ybus(n,m)=ybus(m,n);
+end
+Y=ybus;
+
+absY=abs(Y);
+thetaY=atan(imag(Y),real(Y));
+v=vsp';
+iteration=0; //Initialization of iteration count
+ang=zeros(1,nb);
+mismatch=ones(2*nb-2-npv,1);
+tol=1e-4; //Tolerance value for Newton Raphson Load Flow
+
+while max(abs(mismatch))>tol & iteration<100 //Maximum iteration count is limited to 100
+ J1=zeros(nb-1,nb-1);
+ J2=zeros(nb-1,nb-npv-1);
+ J3=zeros(nb-npv-1,nb-1);
+ J4=zeros(nb-npv-1,nb-npv-1);
+ P=zeros(nb,1);
+ Q=P;
+ del_P=Q;
+ del_Q=Q;
+ del_del=zeros(nb-1,1);
+ del_v=zeros(nb-1-npv,1);
+ ang;
+ mag=abs(v);
+ for i=2:nb
+ for j=1:nb
+ P(i)=P(i)+mag(i)*mag(j)*absY(i,j)*cos(thetaY(i,j)-ang(i)+ang(j));
+ if rem(i)~=2
+ Q(i)=Q(i)+mag(i)*mag(j)*absY(i,j)*sin(thetaY(i,j)-ang(i)+ang(j));
+ end
+ end
+ end
+//Q=-1*Q;
+del_P=Psp-P;
+del_Q=Qsp-Q;
+for i=2:nb
+ for j=2:nb
+ if j~=i
+ J1(i-1,j-1)=-mag(i)*mag(j)*absY(i,j)*sin(thetaY(i,j)-ang(i)+ang(j));
+ J2(i-1,j-1)=mag(i)*absY(i,j)*cos(thetaY(i,j)-ang(i)+ang(j));
+ J3(i-1,j-1)=-mag(i)*mag(j)*absY(i,j)*cos(thetaY(i,j)-ang(i)+ang(j));
+ J4(i-1,j-1)=-mag(i)*absY(i,j)*sin(thetaY(i,j)-ang(i)+ang(j));
+ end
+ end
+end
+for i=2:nb
+ for j=1:nb
+ if j~=i
+ J1(i-1,i-1)=J1(i-1,i-1)+mag(i)*mag(j)*absY(i,j)*sin(thetaY(i,j)-ang(i)+ang(j));
+ J2(i-1,i-1)=J2(i-1,i-1)+mag(j)*absY(i,j)*cos(thetaY(i,j)-ang(i)+ang(j));
+ J3(i-1,i-1)=J3(i-1,i-1)+mag(i)*mag(j)*absY(i,j)*cos(thetaY(i,j)-ang(i)+ang(j));
+ J4(i-1,i-1)=J4(i-1,i-1)+mag(j)*absY(i,j)*sin(thetaY(i,j)-ang(i)+ang(j));
+ end
+ end
+ J2(i-1,i-1)=2*mag(i)*absY(i,i)*cos(thetaY(i,i))+J2(i-1,i-1);
+ J4(i-1,i-1)=-2*mag(i)*absY(i,i)*sin(thetaY(i,i))-J4(i-1,i-1);
+ end
+J=[J1 J2;J3 J4] //Entire Jacobian matrix of the system
+lenJ=length(J1);
+i=2;
+j=1;
+while j<=lenJ
+ if rem(i)==2
+ j=j+1;
+ else
+ J(:,length(J1)+j)=[];
+ lenJ=lenJ-1;
+ end
+end
+i=i+1;
+lenJ=length(J1);
+i=1;
+j=2;
+while i<=lenJ
+ if rem(j)==3
+ i=i+1;
+ else
+ J(length(J1)+i,:)=[];
+ lenJ=lenJ-1;
+ Q(i+1)=[]
+ del_Q(i+1,:)=[]
+ end
+ end
+P(1,:)=[] //Removing slack bus entries
+Q(1,:)=[]
+del_P(1,:)=[];
+del_Q(1,:)=[];
+mismatch=[del_P;del_Q];
+del=J\mismatch;
+del_del=del(1:nb-1);
+del_v=del(nb:length(del));
+ang=ang(2:nb)+del_del'; //Updating voltage angle for PV and PQ buses
+j=1;
+for i=2:nb //Step to update voltage magnitude for all PQ buses
+ if rem(i)==3
+ v(i)=v(i)+del_v(j);
+ j=j+1;
+ end
+end
+mag=abs(v);
+ang=[0 ang];
+nbr=1:nb;
+iteration=iteration+1;
+if iteration==1
+ [r c]=size(J);
+ printf('The size of the Jacobian matrix is %d X %d\n',r,c)
+ printf('The change in power at the end of first iteration is DelP2=%.4f pu\n',del_P(1))
+ printf('The Jacobian matrix element J1(2,4) after first iteration is: %.4f pu\n',J(1,3))
+ disp(J,'The Jacobian Matrix of the system at the end of first iteration is given by:')
+end
+end
+
diff --git a/3872/CH6/EX6.17/Ex6_17.jpg b/3872/CH6/EX6.17/Ex6_17.jpg Binary files differnew file mode 100644 index 000000000..d6558e3be --- /dev/null +++ b/3872/CH6/EX6.17/Ex6_17.jpg diff --git a/3872/CH6/EX6.17/Ex6_17.sce b/3872/CH6/EX6.17/Ex6_17.sce new file mode 100644 index 000000000..28cfbff42 --- /dev/null +++ b/3872/CH6/EX6.17/Ex6_17.sce @@ -0,0 +1,46 @@ +//Book - Power System: Analysis & Design 5th Edition
+//Authors - J. Duncan Glover, Mulukutla S. Sarma, and Thomas J. Overbye
+//Chapter - 6 ; Example 6.17
+//Scilab Version - 6.0.0 ; OS - Windows
+
+clear;
+clc;
+
+linedata=[2 4 0.0090 0.10 1.72 //Entering line data from table 6.2 & 6.3
+ 2 5 0.0045 0.05 0.88
+ 4 5 0.00225 0.025 0.44
+ 1 5 0.00150 0.02 0.00
+ 3 4 0.00075 0.01 0.00];
+linedata(:,3)=0 //Neglecting Line resistance
+linedata(:,5)=0 //Neglecting shunt suceptance
+//enter busdata in the order type (1.slack,2.pv,3.pq),PG,QG,PL,QL,vmag,del,Qmin and Qmax.
+//Data is taken from table 6.1
+Busdata=[1 0 0 0 0 1 0 0 0
+ 3 0 0 8 2.8 1 0 0 0
+ 2 5.2 0 0.8 0.4 1.05 0 4 -2.8
+ 3 0 0 0 0 1 0 0 0
+ 3 0 0 0 0 1 0 0 0]
+
+sb= linedata(:,1);
+sb=linedata(:,1) //Starting bus number of all the lines stored in variable sb
+eb=linedata(:,2) //Ending bus number of all the lines stored in variable eb
+lz=linedata(:,3)+linedata(:,4)*%i; //lineimpedance=R+jX
+sa=linedata(:,5)*%i; //shunt admittance=jB since conductsnce G=0 for all lines
+nb=max(max(sb,eb));
+ybus=zeros(nb,nb);
+for i=1:length(sb)
+ m=sb(i);
+ n=eb(i);
+ ybus(m,m)=ybus(m,m)+1/lz(i)+sa(i)/2;
+ ybus(n,n)=ybus(n,n)+1/lz(i)+sa(i)/2;
+ ybus(m,n)=-1/lz(i);
+ ybus(n,m)=ybus(m,n);
+end
+
+B=imag(ybus(2:nb,2:nb)) //B matrix is the imaginary part of bus admittance matrix neglecting slack bus
+P=Busdata(2:nb,2)-Busdata(2:nb,4) //Net power at each PV and PQ bus
+delta=-inv(B)*P
+deltad=delta*180/(%pi) //Converting delta from radian to degree
+disp(B, 'The B Matrix is given by:')
+disp(P,'The P Matrix is given by:')
+disp(deltad,'The values of delta in degrees is given by:')
diff --git a/3872/CH6/EX6.2/Ex6_2.jpg b/3872/CH6/EX6.2/Ex6_2.jpg Binary files differnew file mode 100644 index 000000000..ed04ba716 --- /dev/null +++ b/3872/CH6/EX6.2/Ex6_2.jpg diff --git a/3872/CH6/EX6.2/Ex6_2.sce b/3872/CH6/EX6.2/Ex6_2.sce new file mode 100644 index 000000000..b5d9f5dda --- /dev/null +++ b/3872/CH6/EX6.2/Ex6_2.sce @@ -0,0 +1,26 @@ +//Book - Power System: Analysis & Design 5th Edition
+//Authors - J. Duncan Glover, Mulukutla S. Sarma, and Thomas J. Overbye
+//Chapter - 6 ; Example 6.2
+//Scilab Version - 6.0.0 ; OS - Windows
+
+clc;
+clear;
+
+A=[2 3 -1;-4 6 8;10 12 14];
+y=[5;7;9];
+N=length(y); //Number of variables
+st=N-1; //Number of Gauss elimination steps
+
+//Gauss Elimination step:
+B=A;
+for i=1:st
+ for j=i+1:N
+ m=(B(j,i)/B(i,i));
+ A(j,i+1:N)=A(j,i+1:N)-m*(A(i,i+1:N));
+ A(i+1:N,i)=0;
+ y(j)=y(j)-m*y(i);
+ end
+ B=A;
+end
+disp(A,'The triangularized matrix using gauss elemination is:')
+disp(y,'and the corresponding y matrix is:')
diff --git a/3872/CH6/EX6.3/Ex6_3.jpg b/3872/CH6/EX6.3/Ex6_3.jpg Binary files differnew file mode 100644 index 000000000..c292962f1 --- /dev/null +++ b/3872/CH6/EX6.3/Ex6_3.jpg diff --git a/3872/CH6/EX6.3/Ex6_3.sce b/3872/CH6/EX6.3/Ex6_3.sce new file mode 100644 index 000000000..9d9a667f4 --- /dev/null +++ b/3872/CH6/EX6.3/Ex6_3.sce @@ -0,0 +1,30 @@ +//Book - Power System: Analysis & Design 5th Edition
+//Authors - J. Duncan Glover, Mulukutla S. Sarma, and Thomas J. Overbye
+//Chapter - 6 ; Example 6.3
+//Scilab Version - 6.0.0 ; OS - Windows
+
+clc;
+clear;
+
+A=[10 5;2 9]; //Coefficients of variables in matrix form
+y=[6;3]; //Constant coefficients in matrix form
+tol=1e-4; //Tolerance value
+x=[0;0]
+
+D=[A(1,1) 0;0 A(2,2)]; //Matrix containing the diagonal elements of A
+M=inv(D)*(D-A);
+
+err=1;
+iter=0;
+
+while err>tol
+ temp=x;
+ x=M*x+inv(D)*y;
+ if temp(1) ~= 0 | temp(2) ~= 0
+ err=max(abs((x(1)-temp(1))/temp(1)),abs((x(2)-temp(2))/temp(2)));
+ end
+ iter=iter+1;
+end
+
+printf('The convergence criterion is satisfied at the %dth iteration\n',iter)
+printf('The solution is x1=%.4f and x2=%.4f',x(1),x(2))
diff --git a/3872/CH6/EX6.4/Ex6_4.jpg b/3872/CH6/EX6.4/Ex6_4.jpg Binary files differnew file mode 100644 index 000000000..238bc0acd --- /dev/null +++ b/3872/CH6/EX6.4/Ex6_4.jpg diff --git a/3872/CH6/EX6.4/Ex6_4.sce b/3872/CH6/EX6.4/Ex6_4.sce new file mode 100644 index 000000000..9bd252ccb --- /dev/null +++ b/3872/CH6/EX6.4/Ex6_4.sce @@ -0,0 +1,30 @@ +//Book - Power System: Analysis & Design 5th Edition
+//Authors - J. Duncan Glover, Mulukutla S. Sarma, and Thomas J. Overbye
+//Chapter - 6 ; Example 6.4
+//Scilab Version - 6.0.0 ; OS - Windows
+
+clc;
+clear;
+
+A=[10 5;2 9]; //Coefficients of variables in matrix form
+y=[6;3]; //Constant coefficients in matrix form
+tol=1e-4; //Tolerance value
+x=[0;0]
+
+D=[A(1,1) 0;A(2,1) A(2,2)]; //Matrix containing the lower triangular elements of A
+M=inv(D)*(D-A);
+
+err=1;
+iter=0;
+
+while err>tol
+ temp=x;
+ x=M*x+inv(D)*y;
+ if temp(1) ~=0 |temp(2)~=0
+ err=max(abs((x(1)-temp(1))/temp(1)),abs((x(2)-temp(2))/temp(2)));
+ end
+ iter=iter+1;
+end
+
+printf('The convergence criterion is satisfied at the %dth iteration\n',iter)
+printf('The solution is x1=%.4f and x2=%.4f',x(1),x(2))
diff --git a/3872/CH6/EX6.5/Ex6_5.jpg b/3872/CH6/EX6.5/Ex6_5.jpg Binary files differnew file mode 100644 index 000000000..6a6081f15 --- /dev/null +++ b/3872/CH6/EX6.5/Ex6_5.jpg diff --git a/3872/CH6/EX6.5/Ex6_5.sce b/3872/CH6/EX6.5/Ex6_5.sce new file mode 100644 index 000000000..d40df99c5 --- /dev/null +++ b/3872/CH6/EX6.5/Ex6_5.sce @@ -0,0 +1,43 @@ +//Book - Power System: Analysis & Design 5th Edition
+//Authors - J. Duncan Glover, Mulukutla S. Sarma, and Thomas J. Overbye
+//Chapter - 6 ; Example 6.5
+//Scilab Version - 6.0.0 ; OS - Windows
+
+clc;
+clear;
+
+A=[5 10;9 2]; //Coefficients of variables in matrix form
+y=[6;3]; //Constant coefficients in matrix form
+tol=1e-4; //Tolerance value
+x=[0;0]
+
+//Solution by matrix inversion
+
+xm=inv(A)*y;
+
+//Solution using Gauss–Seidel method
+
+D=[A(1,1) 0;A(2,1) A(2,2)]; //Matrix containing the lower triangular elements of A
+M=inv(D)*(D-A);
+
+err=1;
+iter=0;
+
+while err>tol
+ temp=x;
+ x=M*x+inv(D)*y;
+ if temp(1) ~=0 | temp(2) ~= 0
+ err=max(abs((x(1)-temp(1))/temp(1)),abs((x(2)-temp(2))/temp(2)));
+ end
+ iter=iter+1;
+end
+
+printf('The solution using matrix inversion is x1=%.4f and x2=%.4f\n\n',xm(1),xm(2))
+printf('Soultion using Gauss-Seidal approach:\n')
+if isnan(err)
+ printf('The convergence criterion is not reached.The solution diverges\n')
+else
+ printf('The convergence criterion is satisfied at the %dth iteration\n',iter)
+ printf('The solution is x1=%.4f and x2=%.4f',x(1),x(2))
+end
+
diff --git a/3872/CH6/EX6.6/Ex6_6.jpg b/3872/CH6/EX6.6/Ex6_6.jpg Binary files differnew file mode 100644 index 000000000..aa72c508b --- /dev/null +++ b/3872/CH6/EX6.6/Ex6_6.jpg diff --git a/3872/CH6/EX6.6/Ex6_6.sce b/3872/CH6/EX6.6/Ex6_6.sce new file mode 100644 index 000000000..0347ec1a4 --- /dev/null +++ b/3872/CH6/EX6.6/Ex6_6.sce @@ -0,0 +1,48 @@ +//Book - Power System: Analysis & Design 5th Edition
+//Authors - J. Duncan Glover, Mulukutla S. Sarma, and Thomas J. Overbye
+//Chapter - 6 ; Example 6.6
+//Scilab Version - 6.0.0 ; OS - Windows
+
+clc;
+clear;
+
+//Solution for x^2=9 using Newton Raphson method:
+err=1;
+iternr=0; //Initial iteration value for Newton Raphson method
+tol=1e-4; //Tolerance value for Newton Raphson method
+xn=1; //Initial value for x for Newton Raphson method
+
+while err>tol
+ temp=xn;
+ J=2*xn; // Jacobian Matrix
+ xn=xn+inv(J)*(9-xn^2);
+ err=abs((xn-temp)/temp)
+ iternr=iternr+1;
+end
+
+//Solution for x^2=9 using Gauss–Seidel method
+err=1;
+D=3;
+itergs=0; //Initial iteration value for Gauss Seidal method
+xg=1; //Initial value for x for Gauss Seidal method
+
+while err>tol & itergs<iternr+1
+ temp=xg;
+ xg=xg+inv(D)*(9-xg^2)
+ err=abs((xg-temp)/temp)
+ itergs=itergs+1
+end
+printf('SOLUTION USING NEWTON RAPHSON METHOD:\n')
+printf('The convergence criterion is satisfied at the %dth iteration\n',iternr)
+printf('The solution is x=%.4f\n\n',xn)
+
+printf('SOLUTION USING GAUSS SEIDEL METHOD:\n')
+printf('The value for x at the end of %dth iteration\n',itergs)
+printf('is obtained as x=%.4f\n\n',xg)
+
+printf('COMPARISON:\n')
+if itergs>iternr
+ printf('Gauss Seidel method takes more time to converge')
+else
+ printf('Newton Raphson method takes more time to converge')
+end
diff --git a/3872/CH6/EX6.7/Ex6_7.jpg b/3872/CH6/EX6.7/Ex6_7.jpg Binary files differnew file mode 100644 index 000000000..9cd2a468f --- /dev/null +++ b/3872/CH6/EX6.7/Ex6_7.jpg diff --git a/3872/CH6/EX6.7/Ex6_7.sce b/3872/CH6/EX6.7/Ex6_7.sce new file mode 100644 index 000000000..53060d05e --- /dev/null +++ b/3872/CH6/EX6.7/Ex6_7.sce @@ -0,0 +1,25 @@ +//Book - Power System: Analysis & Design 5th Edition
+//Authors - J. Duncan Glover, Mulukutla S. Sarma, and Thomas J. Overbye
+//Chapter - 6 ; Example 6.7
+//Scilab Version - 6.0.0 ; OS - Windows
+
+clc;
+clear;
+
+c=[15;50]; //Constant coefficients in the equations
+x=[4;9]; //Initial values for x1 and x2
+
+err=1; //Initialization of error value
+tol=1e-4; //Tolerance value for Newton Raphson method
+iter=0; //Initialization of iteration value
+
+while err>tol
+ temp=x;
+ f=[x(1)+x(2);x(1)*x(2)] //Function Value
+ J=[1 1;x(2) x(1)]; //Jacobian Matrix
+ x=x+inv(J)*(c-f)
+ err=max(abs((x(1)-temp(1))/temp(1)),abs((x(2)-temp(2))/temp(2)));
+ iter=iter+1;
+end
+printf('The convergence criterion is satisfied at the %dth iteration\n',iter)
+printf('The solution is x1=%.4f and x2=%.4f',x(1),x(2))
diff --git a/3872/CH6/EX6.8/Ex6_8.jpg b/3872/CH6/EX6.8/Ex6_8.jpg Binary files differnew file mode 100644 index 000000000..723f22378 --- /dev/null +++ b/3872/CH6/EX6.8/Ex6_8.jpg diff --git a/3872/CH6/EX6.8/Ex6_8.sce b/3872/CH6/EX6.8/Ex6_8.sce new file mode 100644 index 000000000..b7e1e028f --- /dev/null +++ b/3872/CH6/EX6.8/Ex6_8.sce @@ -0,0 +1,39 @@ +//Book - Power System: Analysis & Design 5th Edition
+//Authors - J. Duncan Glover, Mulukutla S. Sarma, and Thomas J. Overbye
+//Chapter - 6 ; Example 6.8
+//Scilab Version - 6.0.0 ; OS - Windows
+
+clc;
+clear;
+
+y=[15;50]; //Constant coefficients in the equations
+x=[4;9]; //Initial values for x1 and x2
+
+err=1; //Initialization of error value
+tol=1e-4; //Tolerance value for Newton Raphson method
+iter=0; //Initialization of iteration value
+
+while err>tol
+ temp=x;
+ f=[x(1)+x(2);x(1)*x(2)] //Function Value
+ dely=y-f;
+ J=[1 1;x(2) x(1)]; //Jacobian Matrix
+ //Reduction of Jacobian using Gauss elimination
+ Jg=[J(1,1) J(1,2);0 J(2,2)-J(2,1)/J(1,1)]
+ delyg=[dely(1);dely(2)-dely(1)*J(2,1)/J(1,1)]
+ //Solution using back substitution
+ delx2=delyg(2)/Jg(2,2);
+ delx1=(delyg(1)-Jg(1,2)*delx2)/Jg(1,1)
+ delx=[delx1;delx2]
+ x=x+delx
+ err=max(abs((x(1)-temp(1))/temp(1)),abs((x(2)-temp(2))/temp(2)));
+ iter=iter+1;
+ //Displaying first iteration results
+ if iter==1
+ printf('Values of x1 and x2 at the end of first iteration are:\n')
+ printf(' x1=%.4f and x2=%.4f\n\n',x(1),x(2))
+ end
+end
+printf('The convergence criterion is satisfied at the %dth iteration\n',iter)
+printf('The solution is x1=%.4f and x2=%.4f',x(1),x(2))
+
diff --git a/3872/CH6/EX6.9/Ex6_9.jpg b/3872/CH6/EX6.9/Ex6_9.jpg Binary files differnew file mode 100644 index 000000000..52dfa67bc --- /dev/null +++ b/3872/CH6/EX6.9/Ex6_9.jpg diff --git a/3872/CH6/EX6.9/Ex6_9.sce b/3872/CH6/EX6.9/Ex6_9.sce new file mode 100644 index 000000000..4d8d8df14 --- /dev/null +++ b/3872/CH6/EX6.9/Ex6_9.sce @@ -0,0 +1,31 @@ +//Book - Power System: Analysis & Design 5th Edition
+//Authors - J. Duncan Glover, Mulukutla S. Sarma, and Thomas J. Overbye
+//Chapter - 6 ; Example 6.8
+//Scilab Version - 6.0.0 ; OS - Windows
+
+clc;
+clear;
+
+linedata=[2 4 0.0090 0.10 1.72 //Entering line data from table 6.2 & 6.3
+ 2 5 0.0045 0.05 0.88
+ 4 5 0.00225 0.025 0.44
+ 1 5 0.00150 0.02 0.00
+ 3 4 0.00075 0.01 0.00];
+
+sb= linedata(:,1);
+sb=linedata(:,1) //Starting bus number of all the lines stored in variable sb
+eb=linedata(:,2) //Ending bus number of all the lines stored in variable eb
+lz=linedata(:,3)+linedata(:,4)*%i; //lineimpedance=R+jX
+sa=linedata(:,5)*%i; //shunt admittance=jB since conductsnce G=0 for all lines
+nb=max(max(sb,eb));
+ybus=zeros(nb,nb);
+for i=1:length(sb)
+ m=sb(i);
+ n=eb(i);
+ ybus(m,m)=ybus(m,m)+1/lz(i)+sa(i)/2;
+ ybus(n,n)=ybus(n,n)+1/lz(i)+sa(i)/2;
+ ybus(m,n)=-1/lz(i);
+ ybus(n,m)=ybus(m,n);
+end
+disp(ybus(2,:),'The second row elements of Bus Admittance matrix are:')
+disp(ybus,'The Bus Admittance matrix is:')
|