Question

In: Electrical Engineering

matlab codes for fast decoupled power flow using these variables Z 1 2 3 1 -...

matlab codes for fast decoupled power flow using these variables

Z 1 2 3
1 - 0,01+0,03i 0,02+0,04i
2 0,01+0,03i - 0,02+0,03i
3 0,02+0,04i 0,02+0,03i -
BUS 1 BUS 2 BUS 3
P 5 10
Q 2 3
V 1
teta 0

Solutions

Expert Solution

clc

clear

%-------------v-----del-----Pg-----Qg----Pd----Qd-------------

bus = [ 1 1.04 0.00 0.00 0.00 0.00 0.00 0.00 0.00 1;

2 1.02533 0.00 1.63 0.00 0.00 0.00 0.00 0.00 2;

3 1.02536 0.00 0.85 0.00 0.00 0.00 0.00 0.00 2;

4 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 3;

5 1.00 0.00 0.00 0.00 0.90 0.30 0.00 0.00 3;

6 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 3;

7 1.00 0.00 0.00 0.00 1.00 0.35 0.00 0.00 3;

8 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 3;

9 1.00 0.00 0.00 0.00 1.25 0.50 0.00 0.00 3];

% formation of y bus for nominal tap ratio i.e. a=1

%----------------r-------x------------b------------

line = [1 4 0.0 0.0576 0. 1. 0. ;

4 5 0.017 0.092 0.158 1. 0. ;

5 6 0.039 0.17 0.358 1. 0. ;

3 6 0.0 0.0586 0. 1. 0. ;

6 7 0.0119 0.1008 0.209 1. 0. ;

7 8 0.0085 0.072 0.149 1. 0. ;

8 2 0.0 0.0625 0. 1. 0. ;

8 9 0.032 0.161 0.306 1. 0. ;

9 4 0.01 0.085 0.176 1. 0. ];

r = size(line);

p = r(1);

w = line(:,2 );

buses = max(w);

% b=zeros(1,buses);

ybus = zeros(buses,buses);

y = zeros(buses,buses);

for k= 1:p % finding the elements of ybus

l= line(k,1);

m= line(k,2);

y(l,m) = 1/(line(k,3)+ 1i*line(k,4));

y(m,l) = y(l,m);

% b(l) = b(l)+(i*line(k,5))/2;

% b(m) = b(m)+(i*line(k,5))/2;

end

for i = 1:buses

for j = 1:buses

if i==j

ybus(i,j) = ybus(i,j)+sum(y(i,:)); %+ b(i);

end

if i~=j

ybus(i,j) = -1*y(i,j);

end

end

end

ybus;

b = -imag(ybus);

%formation of b' matrtix

b1=zeros(buses-1,buses-1);

for i = 1:buses-1

for j = 1:buses-1

b1(i,j) =b(i+1,j+1);

end

end

b1;

%formation of b" matrtix

%assuming all the load buses are at last

b2=zeros(buses-3,buses-3);

for i = 1:buses-3

for j = 1:buses-3

b2(i,j) =b(i+3,j+3);

end

end

b2

v = bus(:,2);

del = bus(:,3);

Pg = bus(:,4);

Qg = bus(:,5);

Pd = bus(:,6);

Qd = bus(:,7);

Pspec = Pg-Pd;

Qspec = Qg-Qd;

iter = 1;

slack = 1;

tolerance = .01;

flag=1

while flag==1;

m = real(ybus);

n = imag(ybus);

P = zeros(buses,1);

Q = zeros(buses,1);

iter= iter+1;

for i=1:buses %finding bus real and reactive power

for j=1:buses

P(i) = P(i)+ (v(i)*v(j)*(m(i,j)*cos(del(i)-del(j))+n(i,j)*sin(del(i)-del(j))));

Q(i) = Q(i)+ (v(i)*v(j)*(m(i,j)*sin(del(i)-del(j))-n(i,j)*cos(del(i)-del(j))));

end

end

P

Q

%finding del P by v

for i=1:(buses-1)

if(i<slack)

delP(i,1)= Pspec(i)-P(i);

else

delP(i,1)=(Pspec(i+1)-P(i+1));

end

delPbyv(i,1)=delP(i,1)/v(i,1);

end

%finding del Q by v

c=0;

for i=1:buses

if bus(i,10)==3

c=c+1;

delQ(c,1)= (Qspec(i)-Q(i));

delQbyv(c,1)= delQ(c,1)/v(i,1);

end

end

if max(abs(delP))>tolerance | max(abs(delQ))>tolerance

flag=1; % tolerance check

else

flag=0;

end

%calc correction vector

deldel = inv(b1)*delPbyv;

delv = inv(b2)*delQbyv;

%updating values

for i=1:(buses-1)

del(i+1,1)= del(i+1,1)+deldel(i,1);

end

c=0;

for i=1:buses

if bus(i,10)==3

c=c+1;

v(i,1)=v(i,1)+delv(c,1);

end

end

iter

v

del

end


Related Solutions

a. Using Matlab scripts create the following matrices (???1 and ???2) ???1 = [ 3 2...
a. Using Matlab scripts create the following matrices (???1 and ???2) ???1 = [ 3 2 −3 6 7 4 3 −6 7 ], ???2 = [ 2 1 7 3 3 9 −6 6 1 ]    b. Write code to add the second row of ???1 to the third row of ???2 and store results in the first row of ???1. c. Write code to add the second column of ???1 with the third column of ???2 and...
I need matlab code for solution to the optimal power flow using artificial Ant Colony algorithm
I need matlab code for solution to the optimal power flow using artificial Ant Colony algorithm
Suppose X and Y are independent variables and X~ Bernoulli(1/2) and Y~ Bernoulli(1/3) and Z=X+Y A-...
Suppose X and Y are independent variables and X~ Bernoulli(1/2) and Y~ Bernoulli(1/3) and Z=X+Y A- find the joint probability table B- find the probility distribution table of Z C- find E(X+Y) D- find E(XY) E- find Cov(X, Y)
1.Define what is a cash flow statement. 2. Define leverage. 3)Fast Growing companies have a big...
1.Define what is a cash flow statement. 2. Define leverage. 3)Fast Growing companies have a big appetite for cash. Managers follow 3-key rules in the textbook that can aid in a company's cash flow . What are they? 3. 4. 5. 6.What are the steps of the "cash flow cycle" (5pts.)
Velocity field for this system is: V=[X^2-(y*z^1/2/t)]i-[z*y^3+(x^1/3*z^2/t^1/2)j+[-x^1/3*t^2/z*y^1/2]k find the components of acceleration for the system.
Velocity field for this system is: V=[X^2-(y*z^1/2/t)]i-[z*y^3+(x^1/3*z^2/t^1/2)j+[-x^1/3*t^2/z*y^1/2]k find the components of acceleration for the system.
4. For a signal x(n)=sin(2*pi*n/3) defined for n=0to7, evaluate the Fast Fourier Transform using signal flow...
4. For a signal x(n)=sin(2*pi*n/3) defined for n=0to7, evaluate the Fast Fourier Transform using signal flow graph. (Use decimation in frequency Algorithm)     
3. Write a Matlab script that describes the dynamics of Pressure and Flow in the systemic...
3. Write a Matlab script that describes the dynamics of Pressure and Flow in the systemic arteries and Left Ventricle. Assume that : 1) Pressure in the Left atrium (PLA) and in the Systemic Veins (Psv) remain constant. 2) A time dependent LV compliance 3) Opening/Closing of the heart valves instantaneously with the direction of flow (i.e. valves are at an open or closed states. Use parameter values from the handout.
2. Let ?1, ?2, ?3 be 3 independent random variables with uniform distribution on [0, 1]....
2. Let ?1, ?2, ?3 be 3 independent random variables with uniform distribution on [0, 1]. Let ?? be the ?-th smallest among {?1, ?2, ?3}. Find the variance of ?2, and the covariance between the median ?2 and the sample mean ? = 1 3 (?1 + ?2 + ?3).
Mystery(y, z: positive integer) 1 x=0 2 while z > 0 3       if z mod 2...
Mystery(y, z: positive integer) 1 x=0 2 while z > 0 3       if z mod 2 ==1 then 4                x = x + y 5       y = 2y 6       z = floor(z/2)           //floor is the rounding down operation 7 return x Simulate this algorithm for y=4 and z=7 and answer the following questions: (3 points) At the end of the first execution of the while loop, x=_____, y=______ and z=_______. (3 points) At the end of the second execution of...
Show complete solution 1. Show that the lines ?/1 = y+3/ 2 = z+1/3 and x-3/2...
Show complete solution 1. Show that the lines ?/1 = y+3/ 2 = z+1/3 and x-3/2 = y/1 = z-1/-1 intersect by finding their point of intersection. Find the equation of the plane determined by these lines. Find parametric equations for the line that is perpendicular to the two lines and passes through their point of intersection.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT