ECE6320_HW01SolMatlab (1)

pdf

School

Georgia Institute Of Technology *

*We aren’t endorsed by this school

Course

6320

Subject

Electrical Engineering

Date

Dec 6, 2023

Type

pdf

Pages

6

Report

Uploaded by ovrovg

1 ECE6320 POWER SYSTEM OPERATION AND CONTROL FALL 2023 Homework 1: SOLUTIONS (3 points) Due Date: Wednesday, September 6 Problem 1 a) Develop a computer program to build the Ybus matrix for a system with the following data. Present the source code and the output matrix. Transmission Line Data (values in p.u.) From Bus To Bus R X Tot. Charging 1 2 0 0.2 0 1 3 0 0.5 0 1 4 0 0.1 0 2 3 0 0.25 0 2 4 0 0.4 0 3 5 0 0.6 0 b) How would Ybus change if line 1-2 is upgraded to a line with the following parameters? From Bus To Bus R (p.u.) X (p.u.) Tot. Charging 1 2 0.10 0.250 0.100 Solution: clear all j = sqrt(-1); % 1.a % INPUT = [ % 1 2 0 0.2 0; % 1 3 0 0.5 0; % 1 4 0 0.1 0; % 2 3 0 0.25 0; % 2 4 0 0.4 0; % 3 5 0 0.6 0]; % 1.b INPUT = [ 1 2 0.1 0.25 0.1; 1 3 0 0.5 0; 1 4 0 0.1 0; 2 3 0 0.25 0; 2 4 0 0.4 0; 3 5 0 0.6 0]; % build Ybus nlines = size(INPUT,1); Ybus = zeros(5,5); fr_node = INPUT(:,1); to_node = INPUT(:,2); r = INPUT(:,3); x = INPUT(:,4);
2 bc = INPUT(:,5); for i = 1:nlines row = fr_node(i); col = to_node(i); Ybus(row,col) = -1/(r(i)+j*x(i)); % negative of admittance = 1/jX = -j(1/X) end % Add transpose to create symmetric matrix Ybus = Ybus + transpose(Ybus) d = -sum(Ybus,2); Ybus = Ybus + diag(d) % add line charging for i = 1:nlines row = fr_node(i); col = to_node(i); Ybus(row,row) = Ybus(row,row) + j*0.5*bc(i); Ybus(col,col) = Ybus(col,col) + j*0.5*bc(i); end Output: a) Ybus = 0.0000 -17.0000i 0.0000 + 5.0000i 0.0000 + 2.0000i 0.0000 +10.0000i 0.0000 + 0.0000i 0.0000 + 5.0000i 0.0000 -11.5000i 0.0000 + 4.0000i 0.0000 + 2.5000i 0.0000 + 0.0000i 0.0000 + 2.0000i 0.0000 + 4.0000i 0.0000 - 7.6667i 0.0000 + 0.0000i 0.0000 + 1.6667i 0.0000 +10.0000i 0.0000 + 2.5000i 0.0000 + 0.0000i 0.0000 -12.5000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 1.6667i 0.0000 + 0.0000i 0.0000 - 1.6667i b) Ybus = 1.3793 -15.4483i -1.3793 + 3.4483i 0.0000 + 2.0000i 0.0000 +10.0000i 0.0000 + 0.0000i -1.3793 + 3.4483i 1.3793 - 9.9483i 0.0000 + 4.0000i 0.0000 + 2.5000i 0.0000 + 0.0000i 0.0000 + 2.0000i 0.0000 + 4.0000i 0.0000 - 7.6667i 0.0000 + 0.0000i 0.0000 + 1.6667i 0.0000 +10.0000i 0.0000 + 2.5000i 0.0000 + 0.0000i 0.0000 -12.5000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 1.6667i 0.0000 + 0.0000i 0.0000 - 1.6667i
3 Problem 2 Write a computer program to reproduce the values shown on slide L02_30 (solution of a power flow problem using Gauss). Report the program code and the program output. Solution: Matlab M-file: clear all; i = sqrt(-1); E2 = 1 + i*0; % Flat start v =0; err=999; while err > 0.00001, Res = [v E2 err] v = v+1; E2new = ((-1+i*0.5)/conj(E2)-(-5+i*15)*(1.0+i*0.0))/(5-i*14.70); err=abs(E2new-E2); E2=E2new; end; Matlab Result >> HW01_2 Res = 0 1 999 Res = 1.0000 0.9671 - 0.0568i 0.0657 Res = 2.0000 0.9624 - 0.0553i 0.0049 Res = 3.0000 0.9622 - 0.0556i 0.0004 Res = 4.0000 0.9622 - 0.0556i 0.0000
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
4 Problem 3 Reproduce the values shown on slide L02_39 (solution of a power flow problem including a PV bus). Report the program code and the program output. Solution: Matlab M-file clear all; v = -1; Y = [5-1i*14.95 , -5+1i*15 ; -5+1i*15 , 5-1i*14.7]; E1 = 1; P2 = 0; E2 = 1.05; E2_temp = 0; out = []; for k = 0:2 Q2 = -imag(conj(E2)*(Y(2,1)*E1+Y(2,2)*E2)); E2_temp = 1/Y(2,2)*((P2-1i*Q2)/conj(E2)-Y(2,1)*E1); E2 = abs(E2)*exp(1i*angle(E2_temp)); v=v+1; out = [out;v,P2,Q2,abs(E2_temp),180/pi*angle(E2_temp), abs(E2),180/pi*angle(E2)]; end; Matlab Result; v P2 Q2 V2_t Theta2_t V2 Theta2 0 0 0.457 1.045 -0.836 1.050 -0.836 1 0 0.535 1.049 -0.941 1.050 -0.941 2 0 0.545 1.050 -0.955 1.050 -0.955
5 Problem 4 Determine the solution of the following simultaneous system of equations using Newton’s method. 2 2 1 1 2 3 2 2 2 2 1 2 1 2 3 2 2 2 3 1 2 2 3 3 ( ) 2 4 0 ( ) 2 5 0 ( ) 3 2 7 0 f x x x f x x x x x f x x x x x = + + = = + + = = + + = x x x Calculate the Jacobian explicitly Report the code and the program output for the functions f and variables x at each iteration. Assume the initial condition is 1 2 3 1; 2; 1. x x x = = Solution: Matlab M-file clear all clc %format short e % exponential v=0; x=[1; 1; 1]; % column vector err = 999; iter = 0 while err > 0.001, iter = iter + 1; f = [x(1)^2+2*x(2)^2+x(3)-4; 2*x(1)^2-x(2)^2+x(1)*x(2)+x(3)^2-5; x(1)^2-3*x(2)^2+x(2)*x(3)+2*x(3)^2-7]; J = [ 2*x(1) 4*x(2) 1; 4*x(1)+x(2) x(1)-2*x(2) 2*x(3); 2*x(1) x(3)-6*x(2) 4*x(3)-x(2)]; dx = -inv(J)*f; I(iter,:) = iter; X(iter,:) = x'; F(iter,:) = f'; E(iter,:) = err; err = max(abs(f)); x = x + dx; v = v + 1; end ; [I X F E] Matlab Result ans = 1.0000 1.0000 1.0000 1.0000 0 -2.0000 -6.0000 999.0000 2.0000 0.6226 0.7358 2.8113 0.2820 3.5956 9.6390 6.0000 3.0000 1.2326 0.7190 1.8193 0.3726 1.7176 0.8961 9.6390 4.0000 0.9106 0.8531 1.8547 0.1396 0.1474 0.1079 1.7176 5.0000 0.8931 0.8285 1.8309 0.0015 0.0010 -0.0404 0.1474 6.0000 0.8859 0.8294 1.8395 0.0001 0.0002 0.0145 0.0404 7.0000 0.8883 0.8290 1.8364 0.0000 0.0000 -0.0051 0.0145 8.0000 0.8874 0.8291 1.8375 0.0000 0.0000 0.0018 0.0051 9.0000 0.8878 0.8291 1.8371 0.0000 0.0000 -0.0007 0.0018
6 Problem 5 Reproduce the results of the two-bus system Newton power flow shown on slides L03_22 and L03_23. Report the code and the program output. Show the Jacobian matrix at each iteration. Solution: Matlab M-file clear all; format short v=0; x=[0; 1]; % [theta2; V2] column vector err = 999; while err > 0.0001, f = [x(2)*10*sin(x(1))+2; x(2)*(-10*cos(x(1)))+x(2)^2*10+1]; J = [10*x(2)*cos(x(1)) 10*sin(x(1)); 10*x(2)*sin(x(1)) - 10*cos(x(1))+20*x(2)] dx = -inv(J)*f; Res = [v x' f' err] err = max(abs(f)); x = x + dx; v = v + 1; end; Matlab Result: >> HW01_5 J = 10 0 0 10 Res = 0 0 1 2 1 999 J = 8.8206 -1.9867 -1.7880 8.1993 Res = 1.0000 -0.2000 0.9000 0.2120 0.2794 2.0000 J = 8.3538 -2.3123 -1.9855 7.4441 Res = 2.0000 -0.2333 0.8587 0.0145 0.0190 0.2794 J = 8.3169 -2.3380 -1.9999 7.3850 Res = 3.0000 -0.2360 0.8554 0.0001 0.0001 0.0190 J = 8.3166 -2.3382 -2.0000 7.3846 Res = 4.0000 -0.2360 0.8554 0.0000 0.0000 0.0001
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help