0% found this document useful (0 votes)
10 views7 pages

'Enter The No. of Buses:': For For

The document outlines a MATLAB program for power system analysis, including the Gauss-Seidel method for voltage calculation, transmission line modeling, and optimal power dispatch. It provides user inputs for bus details, line parameters, and generator costs, and computes various electrical parameters such as voltage, current, and efficiency. Additionally, it includes sections for priority-based load sharing among generators and calculates the incremental cost of power delivery.

Uploaded by

mathanmerlin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views7 pages

'Enter The No. of Buses:': For For

The document outlines a MATLAB program for power system analysis, including the Gauss-Seidel method for voltage calculation, transmission line modeling, and optimal power dispatch. It provides user inputs for bus details, line parameters, and generator costs, and computes various electrical parameters such as voltage, current, and efficiency. Additionally, it includes sections for priority-based load sharing among generators and calculates the incremental cost of power delivery.

Uploaded by

mathanmerlin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

GS METHOD

temp=0;
alpa=1.4;
err=1;
tol=0.01;
iter=1;
n=input('Enter the no. of buses:');
V=ones(n,1);
P=zeros(n,1);
Q=zeros(n,1);
for j=1:n
for k=j:n
fprintf('y(%d,%d)',j,k);
y(j,k)=input(':');
y(k,j)=y(j,k);
end
end
y
i=1;
V(i)=input('Enter the slack bus voltage');
for i=2:n
fprintf('Enter bus %d details:',i);
type(i)=input('Enter the type of bus:1 for PQ 2 for PV:');
P(i)=input('P=');
if type(i)==1
Q(i)=input('Q=');
else
V(i)=input('V=');
end
end
while ((err>tol)&&(iter<10))
display('iter no. =');
iter
Vold=V;
for i=2:n
if type(i)==1
for j=1:n
if j~=i
temp=temp+V(j)*y(i,j);
end
end
S=complex(P(i),-Q(i))
V(i)=((S/conj(V(i)))-temp)/y(i,i);
temp=0;
else
for j=1:n
temp=temp+V(j)*y(i,j);
end
Q(i)=-imag(conj(V(i))*temp);
temp=0
for j=1:n
if j~=i
temp=temp+V(j)*y(i,j);
end
end
S=complex(P(i),-Q(i));
cV=S/conj(V(i));
Vang=(cV-temp)/y(i,i);
deta=ANGLE(Vang);
vreal=abs(V(i))*cos(deta);
vimag=abs(V(i))*sin(deta);
V(i)=complex(vreal,vimag);
temp=0;
end
end
V
V=Vold+alpa*(V-Vold);
Vabs=abs(V-Vold);
err=max(Vabs);
iter=iter+1;
end

exp 1a)
%transmission line parameters
r=input('Enter the radius of the line "r" :');
Ds=0.7788*r;
a=input('Enter "1" for three phase transposed"2" for three phase double
circuit "3" for two cond bundle and "4" for three cond bundle ');
switch a

case 1
Dab=input('Enter the distance between the conductor "a&b":');
Dbc=input('Enter the distance between the conductor "b&c":');
Dca=input('Enter the distance between the conductor "c&a":');
GMRL=Ds;
GMRC=r;
case 2
Da1b1=input('Enter the distance between the conductor "a1&b1":');
Da1b2=input('Enter the distance between the conductor "a1&b2":');
Da2b1=input('Enter the distance between the conductor "a2&b1":');
Da2b2=input('Enter the distance between the conductor "a2&b2":');
Db1c1=input('Enter the distance between the conductor "b1&c1":');
Db1c2=input('Enter the distance between the conductor "b1&c2":');
Db2c1=input('Enter the distance between the conductor "b2&c1":');
Db2c2=input('Enter the distance between the conductor "b2&c2":');
Dc1a1=input('Enter the distance between the conductor "c1&a1":');
Dc1a2=input('Enter the distance between the conductor "c1&a2":');
Dc2a1=input('Enter the distance between the conductor "c2&a1":');
Dc2a2=input('Enter the distance between the conductor "c2&a2":');
Da1a2=input('Enter the distance between the conductor "a1&a2":');
Db1b2=input('Enter the distance between the conductor "b1&b2":');
Dc1c2=input('Enter the distance between the conductor "c1&c2":');
d=input('Enter the distance between the conductor in a bundle"d":');
Dab=(Da1b1*Da1b2*Da2b1*Da2b2)^(1/4);
Dbc=(Db1c1*Db1c2*Db2c1*Db2c2)^(1/4);
Dca=(Dc1a1*Dc1a2*Dc2a1*Dc2a2)^(1/4);
Dsb=(Ds*d)^(1/2);
DSA=(Dsb*Da1a2)^(1/2);
DSB=(Dsb*Db1b2)^(1/2);
DSC=(Dsb*Dc1c2)^(1/2);
DSD=(DSA*DSB*DSC)^(1/3);
GMRL=DSD;
%Computation of GMRC
Dab=(Da1b1*Da1b2*Da2b1*Da2b2)^(1/4);
Dbc=(Db1c1*Db1c2*Db2c1*Db2c2)^(1/4);
Dca=(Dc1a1*Dc1a2*Dc2a1*Dc2a2)^(1/4);
Dsb=(r*d)^(1/2);
DSA=(Dsb*Da1a2)^(1/2);
DSB=(Dsb*Db1b2)^(1/2);
DSC=(Dsb*Dc1c2)^(1/2);
DSD=(DSA*DSB*DSC)^(1/3);
GMRC=DSD;
case 3
Dab=input('Enter the distance between the conductor "a&b":');
Dbc=input('Enter the distance between the conductor "b&c":');
Dca=input('Enter the distance between the conductor "c&a":');
d=input('Enter the distance between the conductor in a bundled":');
%computation of GMRL
Dsb=(Ds*d)^(1/2);
GMRL=Dsb;
%computation of GMRC
Dsb=(r*d)^(1/2);
GMRC=Dsb;
case 4
Dab=input('Enter the distance between the conductor "a&b":');
Dbc=input('Enter the distance between the conductor "b&c":');
Dca=input('Enter the distance between the conductor "c&a":');
d=input('Enter the distance between the conductor in a bundle"d":');
%computation of GMRL
Dsb=(Ds*d^2)^(1/3);
GMRL=Dsb;
%computation of GMRC
Dsb=(r*d^2)^(1/3);
GMRC=Dsb;
end
GMD=(Dab*Dbc*Dca)^(1/3);
disp('GMD=');
disp(GMD);
disp('GMRC=');
disp(GMRC);
disp('GMRL=');
disp(GMRL);
L=0.2*log(GMD/GMRL);
C=0.0556/log(GMD/GMRC);
disp('L in mH/Km=');
disp(L);
disp('C in micro Farad /Km=');
disp

modelling 1a)
Z=input('enter the impedance of the transmission line:');
Y=input('enter the admittance of the transmission line:');
Vr=input('enter the receiving end voltage in V is:');
Pr=input ('enter the receiving end power in W is:');
pfr=input('enter the receiving end power factor:');
Vrph=Vr/sqrt(3);
detar=acos(pfr);
Irph=(Pr/(3*Vrph*cos(detar)))*(cos(detar)-1i*sin(detar));
A=1+(Z*Y/2);
disp(A);
B=Z;
C=Y*(1+(Z*Y/4));
disp(C);
D=A;
Vsph=A*Vrph+B*Irph;
disp(Vsph);
Isph=C*Vrph+D*Irph;
disp(Isph);
deta=angle(Vsph)-angle(Isph);
disp('magnitude of sending end Voltage in Kv is:');
disp(sqrt(3)*abs(Vsph)/1000);
disp('magnitude of sending end current in A is:');
disp(abs(Isph));
disp('sending end power factor:');
disp(cos(deta));
Regn=(abs(Vsph/A)-abs(Vrph))/abs(Vrph);
disp(‘Regn’);
disp(Regn);
Ps=(3*abs(Vsph)*abs(Isph)*cos(deta));
disp(‘Ps’);
disp(Ps);
Efficiency=100*Pr/Ps;
disp(‘Efficiency’);
disp(Efficiency);

modelling 2:
% modeling of transmission lines
Z=input('enter the impedance of the transmission line:');
Y=input('enter the admittance of the transmission line:');
Vs=input('enter the sending end voltage in V is:');
Ps=input ('enter the sending end power in W is:');
Is=input ('enter the sending end current in A is:');
pfs=input('enter the sending end power factor:');
Vsph=Vs/sqrt(3);
detas=acos(pfs);
Isph=(Ps/(3*Vsph*cos(detas)))*(cos(detas)-1i*sin(detas));
A=1+(Z*Y/2);
disp(A);
B=Z;
C=Y*(1+(Z*Y/4));
disp(C);
D=A;
Vrph=D*Vsph-B*Isph;
disp(Vrph);
Irph=C*Vsph+A*Isph;
disp(Irph);
deta=angle(Vrph)-angle(Irph);
disp('magnitude of receiving end Voltage in Kv is:');
disp(sqrt(3)*abs(Vrph)/1000);
disp('magnitude of receiving end current in A is:');
disp(abs(Irph));
disp('receiving end power factor:');
disp(cos(deta));
Regn=(abs(Vsph/A)-abs(Vrph))/abs(Vrph);
disp('Regn');
disp(Regn);
Pr=(3*abs(Vrph)*abs(Irph)*cos(deta));
disp('Pr');
disp(Pr);
Efficiency=100*Pr/Ps;
disp('Efficiency');
disp(Efficiency);

With tl:
cost= [200,7.0,0.008;180,6.3,0.009;140,6.8,0.007];
mwlimits=[10,85;10,80;10,70];
pdt=150;
B=[0.000218,0.000093,0.000028;0.000093,0.00028,0.000017;0.000028,0.000017,0
.000179];
beta1=cost(1,2); beta2=cost(2,2);beta3=cost(3,2);
gamma1=cost(1,3); gamma2=cost(2,3);gamma3=cost(3,3);
basemva=100;
lamda=8;
for iter=1:3
P(1)=(lamda-beta1)/(2*(gamma1+(lamda*B(1,1))));
P(2)=(lamda-beta2)/(2*(gamma2+(lamda*B(2,2))));
P(3)=(lamda-beta3)/(2*(gamma3+(lamda*B(3,3))));
PL1=0;
for i=1:3
for j=1:3
PL=(P(i)*B(i,j))*(P(j));
PL1=PL1+PL;
end
end
delp=pdt+PL1-(P(1)+P(2)+P(3));
delpi1=((gamma1+(B(1,1)*beta1)))/(2*((gamma1+(lamda*B(1,1)))^2));
delpi2=((gamma2+(B(2,2)*beta2)))/(2*((gamma2+(lamda*B(2,2)))^2));
delpi3=((gamma3+(B(3,3)*beta3)))/(2*((gamma3+(lamda*B(3,3)))^2));
delpi=delpi1+delpi2+delpi3;
dellamda=delp/delpi;
nwlamda=lamda+dellamda;
lamda=nwlamda;
end
Tcost=(cost(1,1)+beta1*(P(1))+gamma1*(P(1))^2)+(cost(2,1)+beta2*(P(2))
+gamma2*(P(2))^2)
+(cost(3,1)+beta3*(P(3))+gamma3*(P(3))^2);
disp('The Result is ');
fprintf('Incremental cost of delivered power(system lamda) = ');
fprintf('%4g ' , nwlamda); fprintf('\n');
disp('optimal Dispatch of generation : ');
disp(P(1));
disp(P(2));
disp(P(3));
fprintf('Total system loss = '); fprintf('%4g ', PL1);
fprintf('MW');fprintf('\n');
fprintf('Total Generation Cost= '); fprintf('%4g ', Tcost); fprintf('$/h');
fprintf('\n');

MATLAB OUTPUT:

The Result is Incremental cost of delivered power (system lamda) = 7.69954 optimal Dispatch of
generation : 36.1524 62.7382 53.6989 Total system loss = 2.54832 MW Total Generation Cost =
1599.54 $/h
Without tl:
clear;
NG=input('enter the no. of generators-');
load=input('enter the total load demand of the system--');
%the fuel cost equation is c(i)=(1/2)Ai*(Pi)^2+Bi*Pi+Di
A=input('enter the coefficients of p^2 term of each generator :');
B=input('enter the coefficients of p term of each generator :');
Pgmax=input('enter the maximum limit of each generator :');
Pgmin=input('enter the minimum limit of each generator :');
%assume the initial values for lamda and deltalamda
lamda=8;
deltalamda=0.25;
eps=1;
starter=0;
while starter==0
for i=1:NG
Pg(i)=(lamda-B(i))/A(i);
if Pg(i)>Pgmax
Pg(i)=Pgmax(i);
end
if Pg(i)<Pgmin
Pg(i)=Pgmin(i);
end
end
mismatch=sum(Pg)-load;
if abs(mismatch)<eps
starter=1;
elseif mismatch<0
lamda=lamda+deltalamda;
else
lamda=lamda-deltalamda;
end
end
disp('the final value of lamda is: ');
disp(lamda);
disp('the distribution of load shared by units is ;');
disp(Pg);

priority:
input_data=[ 1.1 510 7.2 0.00142 150 600;
1 310 7.85 0.00194 100 400;
1.2 78 7.97 0.00482 50 200;
];
P_load_arr=[550 850];
g=length(P_load_arr);
n=length(input_data(:,1));
Ui=zeros(1,n);
a=input_data(:,4).*input_data(:,1);
b=input_data(:,3).*input_data(:,1);
c=input_data(:,2).*input_data(:,1);
Pmin=input_data(:,5);
Pmax=input_data(:,6);
FLAPC=zeros(n,1);
priority_list=zeros(1,n);
P=zeros(1,n);
FLAPC=(a.*Pmax.*Pmax)+(b.*Pmax)+c;
FLAPC=FLAPC./Pmax;
disp( "asec")
asec_FLAPC=sort(FLAPC)
for k=1:n
priority_list(k)=find(FLAPC==asec_FLAPC(k));
end
priority_list
for j=1:g
P_load=P_load_arr(j);
var=P_load;
Ui=zeros(1,n);
for i=1:n
if(var<Pmax(priority_list(i)))
P(priority_list(i))=var;
if(var>0)
Ui(priority_list(i))=1;
end
break;
else
P(priority_list(i))=Pmax(priority_list(i));
var=var-Pmax(priority_list(i));
Ui(priority_list(i))=1;
end
end
P_load
Ui
P
end

You might also like