I get the answer negative!

1 visualización (últimos 30 días)
arian hoseini
arian hoseini el 27 de Jun. de 2023
Editada: ProblemSolver el 29 de Jun. de 2023
i dont kow why but my Q is negative....this code is for gauss seidel method this line:
Q(n,1)=-(Q(n,1)+ABS_Y_bus(n,m)*ABS_voltage_bus(n,1)*ABS_voltage_bus(m,1)*sind(ANGLE_Y_bus(n,m)+ANGLE_voltage_bus(m,1)-ANGLE_voltage_bus(n,1)));
clear all;
clc;
q=input('insert number of bus: ');
for n=1:q
for m=1:q
if n>m
m=n;
m=m+1;
else
disp('line')
disp(n)
disp(m)
R(n,m)=input('insert resistance of between line= ');
X(n,m)=input('insert reactance of between line= ');
Z(n,m)=R(n,m)+i*X(n,m);
if Z(n,m)==0
Y(n,m)=0;
Y(m,n)=0;
else
Y(n,m)=1/Z(n,m);
Y(m,n)=Y(n,m);
end
end
end
end
for n=1:q
for m=1:q
if n>m
m=n;
m=m+1;
else
if n~=m
Y_bus(n,m)=-Y(n,m);
Y_bus(m,n)=Y_bus(n,m);
end
end
end
end
Y_bus(n,n)=0;
for n=1:q
for m=1:q
Y_bus(n,n)=Y_bus(n,n)+Y(n,m);
end
end
for n=1:q
disp('Number of bus =')
disp(n)
voltage_bus(n,1)=input('insert voltage of bus=');
end
disp('guide:')
disp('If bus is slack bus,insert 1,if bus is PV bus,insert 2,if bus is PQ bus,insert 3')
type_of_bus(n,1)=0;
for n=1:q
disp('Number of bus=')
disp(n)
type_of_bus(n,1)=input('type_of_bus=');
end
ABS_Y_bus=abs(Y_bus);
ANGLE_Y_bus=angle(Y_bus);
P(n,1)=0;
for n=1:q
if 1==type_of_bus(n,1)
P(n,1)=0;
else
disp('insert active power of bus:')
disp(n)
P(n,1)=input('');
if 3==type_of_bus(n,1)
P(n,1)=-P(n,1);
end
end
end
Q(n,1)=0;
for n=1:q
if 1==type_of_bus(n,1) | 2==type_of_bus(n,1)
Q(n,1)=0;
else
disp('insert reactive power of bus:')
disp(n)
Q(n,1)=input('');
if 3==type_of_bus(n,1)
Q(n,1)=-Q(n,1);
end
end
end
%%%%%%%%%%%%%%%%%%
for k=1:10
for n=1:q
if 1==type_of_bus(n,1)
voltage_bus(n,1)=voltage_bus(n,1);
else
if 1~=type_of_bus(n,1)
ABS_voltage_bus=abs(voltage_bus);
ANGLE_voltage_bus=angle(voltage_bus);
end
if 2==type_of_bus(n,1)
for m=1:q
Q(n,1)=-(Q(n,1)+ABS_Y_bus(n,m)*ABS_voltage_bus(n,1)*ABS_voltage_bus(m,1)*sind(ANGLE_Y_bus(n,m)+ANGLE_voltage_bus(m,1)-ANGLE_voltage_bus(n,1)));
end
end
A=0;
for m=1:q
if m~=n
A=A+Y_bus(n,m)*voltage_bus(m,1);
end
end
voltage_bus(n,1)=(1/Y_bus(n,n))*(((P(n,1)-i*Q(n,1))/conj(voltage_bus(n,1)))-A);
end
end
end
voltage_bus
ABS_voltage_bus=abs(voltage_bus)
ANGLE_voltage_bus=angle(voltage_bus)
Q
P

Respuesta aceptada

ProblemSolver
ProblemSolver el 27 de Jun. de 2023
Hello Arian:
You mentioned that your Q value is negative. One possible reason for this issue is the usage of the sind function, which returns the sine of an angle in degrees. If the angles ANGLE_Y_bus and ANGLE_voltage_bus are in radians, you should use the sin function instead of sind.
To fix the issue, replace sind with sin in the line of code mentioned above:
Q(n,1)=-(Q(n,1)+ABS_Y_bus(n,m)*ABS_voltage_bus(n,1)*ABS_voltage_bus(m,1)*sin(ANGLE_Y_bus(n,m)+ANGLE_voltage_bus(m,1)-ANGLE_voltage_bus(n,1)));
  2 comentarios
arian hoseini
arian hoseini el 29 de Jun. de 2023
i tried that it doest work...its all raidan
ProblemSolver
ProblemSolver el 29 de Jun. de 2023
Editada: ProblemSolver el 29 de Jun. de 2023
@arian hoseini The only problem then I can see is the conversion of the formula. I would suggest kindly revist it. The Gauss Seidel Method:
where, and .
Meaning that you are doing ci = - ( ci + Summation term), if you open the brackets, then the term becomes ci = -ci -summation term.
Q(n,1)=Q(n,1)-(ABS_Y_bus(n,m)*ABS_voltage_bus(n,1)*ABS_voltage_bus(m,1)*sin(ANGLE_Y_bus(n,m)+ANGLE_voltage_bus(m,1)-ANGLE_voltage_bus(n,1)));

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by