All 'Calculation of Inductance and Capacitance of 1 Phase Line' 'Enter Diameter in CM:'
All 'Calculation of Inductance and Capacitance of 1 Phase Line' 'Enter Diameter in CM:'
All 'Calculation of Inductance and Capacitance of 1 Phase Line' 'Enter Diameter in CM:'
PROGRAM:
clc;
clear all;
disp('INDUCTANCE(in H/m):');
disp(L);
disp('CAPACITANCE(in F/m):');
disp(C);
OUTPUT:
PROGRAM:
clc;
clear all;
7)*log(D/r1); C=(2*pi*8.854*10^(-
12))/(log(D/rad));
disp('INDUCTANCE(in H/m):');
disp(L);
disp('CAPACITANCE(in F/m):');
disp(C);
OUTPUT:
PROGRAM:
clc;
clear all;
disp('CALCULATION OF INDUCTANCE AND CAPACITANCE OF 3 PHASE
UNSYMMETRIC LINE - TRANSPOSED');
d=input('Enter diameter in cm:');
r=d/2;
rad=r*10^(-2);
Dab=input('Enter distance between conductors A & B in m:');
Dbc=input('Enter distance between conductors B & C in m:');
Deq=(Dab*Dbc*Dca)^(1/3);
r1=rad*0.7788;
L=2*10^(-7)*log(Deq/r1);
C=(2*pi*8.854*10^(-12))/(log(Deq/rad));
disp('INDUCTANCE(in H/m):');
disp(L);
disp('CAPACITANCE(in F/m):');
disp(C);
XL=2*pi*f*L;
XC=1/(2*pi*f*C);
disp(XC);
OUTPUT:
Enter Frequency50
1.1994e-006
9.6804e-012
3.7679e-004
(d) PROGRAM:
clc;
clear all;
disp('CALCULATION OF INDUCTANCE AND CAPACITANCE');
Dab=input('Dab=');
Dbc=input('Dbc=');
Dca=input('Dca=');
d=input('Enter the spacing');
r=d/2;
GMD=[Dab*Dbc*Dca]^(1/3);
disp(GMD);
GMR=(D*d^3)^(1/4);
GMR1=1.09*GMR;
disp(GMR1);
C=0.0556/log(GMD/GMR);
L=0.2*log(GMD/GMR);
disp('INDUCTANCE VALUE IN HENRY');
disp(L);
disp(C);
OUTPUT:
Dca=22
Enter the spacing0.045
13.8591
0.0465
PROGRAM:
clc;
clear all;
R=input('Resistance :');
XL=input('Inductive Reactance :');
XC=input('Capacitive Reactance :');
G=input('Conductance :');
length=input('Length of Transmission Line :');
f=input('Frequency :');
Z1= (R+j*XL)*length;
Y1= (G+j*XC)*length;
A = 1;
B = Z1;
C = 0;
D
=1;
TM = [ A B; C D ];
VRL=input('ENTER RECEIVEING END VOLTAGE :');
VRP=VRL/(sqrt(3));
PR = input('ENTER RECEIVING END LOAD IN MW :');
Pf=input('ENTER THE RECEIVING END LOAD POWER FACTOR :');
h=acos(Pf);
SR=PR/Pf;
SR=SR*(cos(h)+j*sin(h));
QR=imag(SR);
IR=conj(SR)/(3*conj(VRP));
SM=TM*[VRP;IR];
VS=SM(1,1);
IS=SM(2,1);
Pfs=cos(angle(VS)-angle(IS));
SS=3*VS*conj(IS);
VSA=angle(VS)*(180/pi);
ISA=angle(IS)*(180/pi);
VS=sqrt(3)*abs(VS);
IS=abs(IS)*1000;
VREG=((VS/(abs(TM(1,1)))-VRL)/VRL)*100;
PS= real(SS);
QS= imag(SS);
eff=PR/PS*100;
PL=PS-PR;
QL=QS-QR;
Z1 Y1
TM
fprintf('SENDING END LINE VOLTAGE %g at %g degrees \n',VS,VSA);
OUTPUT:
Resistance : 1.5
Inductive Reactance :4
Capacitive Reactance :0
Conductance :0
Length of Transmission Line :1
Frequency : 50
ENTER RECEIVEING END VOLTAGE : 11
ENTER RECEIVING END LOAD IN MW :4
ENTER THE RECEIVING END LOAD POWER FACTOR : 0.8
Z1 =
1.5000 + 4.0000i
Y1 =
0
TM =
EFFICIENCY 92.8092
PROGRAM:
clc;
clear all;
R=input('Resistance :');
XL=input('Inductive Reactance :');
XC=input('Capacitive Reactance :');
G=input('Conductance :');
length=input('Length of Transmission Line :');
f=input('Frequency :');
Z1= (R+j*XL)*length;
Y1= (G+j*XC)*length;
A = 1+(Z1*Y1/2);
B=Z1*(1+(Z1*Y1/4));
C=Y1;
D=A;
otherwise
A = 1+(Z1*Y1/2);
B=Z1;
C=Y1*(1+(Z1*Y1/4));
D=A;
end
TM = [ A B; C D ];
VRL=input('ENTER RECEIVEING END VOLTAGE :');
VRP=VRL/(sqrt(3));
PR = input('ENTER RECEIVING END LOAD IN MW :');
Pf=input('ENTER THE RECEIVING END LOAD POWER FACTOR :');
h=acos(Pf);
SR=PR/Pf;
SR=SR*(cos(h)+j*sin(h));
QR=imag(SR);
IR=conj(SR)/(3*conj(VRP));
SM=TM*[VRP;IR];
VS=SM(1,1);
IS=SM(2,1);
Pfs=cos(angle(VS)-angle(IS));
SS=3*VS*conj(IS);
VSA=angle(VS)*(180/pi);
ISA=angle(IS)*(180/pi);
VS=sqrt(3)*abs(VS);
IS=abs(IS)*1000;
VREG=((VS/(abs(TM(1,1)))-VRL)/VRL)*100;
PS=real(SS);
QS=imag(SS);
eff=PR/PS*100;
PL=PS-PR;
QL=QS-QR;
Z1
Y1
TM
NOMINAL T
OUTPUT:
Resistance : 20
Inductive Reactance : 52
Capacitive Reactance : 315*10^(-6)
Conductance :0
Length of Transmission Line :1
Frequency : 50
ENTER RECEIVEING END VOLTAGE : 132
ENTER RECEIVING END LOAD IN MW : 30
20.0000 +52.0000i
Y1 =
1 +3.1500e-004i
TM =
0.9918 + 0.0031i 19.8362 +51.8186i
1 + 0.0003i 0.9918 + 0.0031i
PROGRAM:
clc;
clear all;
n=input('Enter number of buses');
l=input('Number of lines');
s=input('1.Impedance or 2:Admittance');
ybus=zeros(n,n);
lc=zeros(n,n);
for i=1:l
a=input('Starting bus:');
b=input('Ending bus:');
t=input('Admittance or Impedance of
line:'); lca=input('Line charging
admittance:'); if(s==1)
y(a,b)=1/t;
else
y(a,b)=t;
end
y(b,a)=y(a,b);
lc(a,b)=lca;
lc(b,a)=lc(a,b);
end
for i=1:n
for j=1:n
if i==j
for k=1:n
ybus(i,j)=ybus(i,j)+y(i,k)+lc(i,k)/2;
end
else
ybus(i,j)=-y(i,j);
end
ybus(j,i)=ybus(i,j);
end
end
ybus
OUTPUT:
Number of lines5
1. Impedance or
Ending bus: 2
Starting bus: 2
Ending bus: 3
Starting bus: 3
Ending bus: 4
Admittance or Impedance of line: 0.18+0.55i
Starting bus: 4
Ending bus: 1
Starting bus: 4
Ending bus: 2
ybus
1.3430 - 4.9810i -0.5882 + 2.3529i 0 -0.7547 + 2.6415i
PROGRAM
clc;
clear all;
n=input ('no of buses');
else
y(a,b)=t;
end
y(b,a)=y(a,b);
end
ybus=zeros(n,n);
for i=1:n
for j=1:n
if i==j
for k=1:n
ybus(i,j)=ybus(i,j)+y(i,k);
end
else
ybus(i,j)=-y(i,j);
end
ybus(j,i)=ybus(i,j);
end
end
ybus
p=zeros(1,n);
q=zeros(1,n);
v=zeros(1,n);
pv=input ('no of pv buses');
pq=input('no of pq buses');
s=input ('slack bus number');
v(s)=input ('slack bus voltage');
acc=input ('accleration factor');
for i=1:pv
b(i)=input('pv bus number');
p(b(i))=input('real power');
v(b(i))=input ('voltage value');
qmin(b(i))=input ('min value of q');
qmax(b(i))=input ('max value of q');
end
for i=1:pq
c(i)=input('pq bus number');
p(c(i))=input('real power');
p(c(i))=-p(c(i));
q(c(i))=input ('reactive power');
q(c(i))=-q(c(i));
v(c(i))=1+0i;
end
e=v;
e
enew(s)=v(s);
it=0;
yy=zeros(1,n);
for ii=1:n
ypq(ii)=0;
if ii~=s
flag=0;
gen=0;
for j=1:pv
if ii==b(j)
flag=1;
end
end
if flag==1
for k=1:n
yy(ii)=yy(ii)+ybus(ii,k)*v(k);
end
qcal(ii)=-imag(conj(v(ii))*yy(ii));
if qcal(ii)<qmin(ii)
qcal(ii)=qmin(ii);
elseif qcal(ii)>qmax(ii)
qcal(ii)=qmax(ii);
else
qcal(ii)=qcal(ii);
gen=1;
end
else
qcal(ii)=q(ii);
end
qcal(ii)=qcal(ii)*sqrt(-1);
for k=1:n
if k~=ii
ypq(ii)=ypq(ii)+ybus(ii,k)*e(k);
end
end
enew(ii)=(((p(ii)-qcal(ii))/conj(e(ii)))-ypq(ii))/ybus(ii,ii);
dele(ii)=enew(ii)-e(ii);
enew(ii)=e(ii)+acc*dele(ii);
if gen==1 ang=angle(enew(ii));
enew(ii)=v(ii)*cos(ang)+v(ii)*sin(ang)*sqrt(-1);
end
e(ii)=enew(ii);
end
end
disp('voltages');
enew
OUTPUT:
no of buses4
no of lines5
impedance 1 or admittance 22
starting bus1
ending bus2
admittance or impedance value2-8i
starting bus1
ending bus3
admittance or impedance value1-4i
starting bus2
ending bus3
admittance or impedance value0.666-2.664i
starting bus2
ending bus4
admittance or impedance value1-4i
starting bus3
ending bus4
admittance or impedance value2-8i
ybus =
no of pv buses0 no
of pq buses3 slack
bus number1
slack bus voltage1.06
accleration factor1
pq bus number2
real power0.5
reactive power0.2
pq bus number3
real power0.4
reactive power0.3
pq bus number4
real power0.3
reactive power0.1
e=
voltages
enew =
clc;
basemva=100;
accuracy=0.001;
accel=1.8;
maxiter=100;
busdata=[1 1 1.04 0 0 0 0 0 0 0 0
2 0 1 0 0.5 1 0 0 0 0 0
3 2 1.04 0 0 0 1.5 0.6 0 0 0 ];
linedata=[ 1 2 0.02 0.080.01 1
1 3 0.02 0.08 0.01 1
2 3 0.02 0.08 0.01 1];
lfybus
lfnewton
busout
lineflow
lfybus
j=sqrt(-1); i = sqrt(-1);
nl = linedata(:,1); nr = linedata(:,2); R =
linedata(:,3); X = linedata(:,4); Bc =
j*linedata(:,5); a = linedata(:, 6);
nbr=length(linedata(:,1)); nbus = max(max(nl),
max(nr));
Z = R + j*X; y= ones(nbr,1)./Z; %branch admittance
for n = 1:nbr
if a(n) <= 0 a(n) = 1; else end
for k=1:nbr;
Ybus(nl(k),nr(k))=Ybus(nl(k),nr(k))-y(k)/a(k);
Ybus(nr(k),nl(k))=Ybus(nl(k),nr(k));
end
end
% formation of the diagonal elements
for n=1:nbus
for k=1:nbr
if nl(k)==n
Ybus(n,n) = Ybus(n,n)+y(k)/(a(k)^2) +
Bc(k); elseif nr(k)==n
Ybus(n,n) = Ybus(n,n)+y(k) +Bc(k);
else, end
end
end
clear Pgg
lfnewton
length(busdata(:,1));
for k=1:nbus
n=busdata(k,1);
V(n) = Vm(n)*(cos(delta(n)) +
j*sin(delta(n)));
P(n)=(Pg(n)-Pd(n))/basemva;
Q(n)=(Qg(n)-Qd(n)+ Qsh(n))/basemva;
end
end
for k=1:nbus
end
Ym=abs(Ybus); t = angle(Ybus);
m=2*nbus-ng-2*ns;
maxerror = 1; converge=1;
iter = 0;
% Start of
iterations clear
A DC J DX
axerror >= accuracy & iter <= maxiter % Test for max.
while m
power mismatch for i=1:m
for k=1:m
A(i,k)=0; %Initializing Jacobian matrix
end, end
iter = iter+1;
for n=1:nbus
nn=n-nss(n);
lm=nbus+n-ngs(n)-nss(n)-ns;
J11=0; J22=0; J33=0; J44=0;
for i=1:nbr
if nl(i) == n | nr(i) == n
lk = nbus+l-ngs(l)-nss(l)-ns;
ll = l -nss(l);
% off diagonalelements of J1
else end
Qk = -Vm(n)^2*Ym(n,n)*sin(t(n,n))-J11;
b(n) == 2
if k Q(n)=Qk;
if Q max(n) ~= 0
else,end
else,end
end
if kb(n) ~= 1
if kb(n) == 0
A(nn,lm) = 2*Vm(n)*Ym(n,n)*cos(t(n,n))+J22; %diagonal elements of
J2
end
end
DX=A\DC';
for n=1:nbus
nn=n-nss(n);
lm=nbus+n-ngs(n)-nss(n)-ns;
if kb(n) ~= 1
end
maxerror=max(abs(DC));
V =
Vm.*cos(delta)+j*Vm.*sin(delt
a); deltad=180/pi*delta;
i=sqrt(-
1); k=0;
for n = 1:nbus
if kb(n) == 1
k=k+1;
S(n)= P(n)+j*Q(n);
Pg(n) = P(n)*basemva + Pd(n);
Qgg(k)=Qg(n);
elseif kb(n)
==2 k=k+1;
S(n)=P(n)+j*Q
(n);
Qgg(k)=Qg(n);
end
yload(n) = (Pd(n)- j*Qd(n)+j*Qsh(n))/(basemva*Vm(n)^2);
end
busdata(:,3)=Vm'; busdata(:,4)=deltad';
busout
disp(tech)
fprintf('Maximum Power Mismatch = %g \n', maxerror)
disp(head)
for n=1:nbus
lineflow
SLT = 0;
fprintf('\n')
fprintf('Line Flow and Losses \n\n')
fprintf(' --Line--Power at bus & line flow --Line
loss-- Transformer\n')
fprintf(' from to MW Mvar MVA MW Mvar tap\n')
for n = 1:nbus
busprt = 0;
for L = 1:nbr;
if busprt == 0
fprintf(' \n'), fprintf('%6g', n), fprintf(' %9.3f',
P(n)*basemva)
busprt = 1;
else, end
if nl(L)==n k = nr(L);
Skn = V(k)*conj(Ik)*basemva;
SL = Snk + Skn;
SLT = SLT + SL;
Skn = V(k)*conj(Ik)*basemva;
SL = Snk + Skn;
SLT = SLT + SL;
else, end
if nl(L)==n | nr(L)==n
fprintf('%12g', k),
fprintf('%9.3f', real(SL)),
else, end
end
end
SLT = SLT/2;
OUTPUT:
OUTPUT:
Enter Fault Impedance Zf = R + j*X in complex form (for bolted fault enter 0). Zf = j*0.1
1 0.5938 0.0000
2 0.6250 0.0000
3 0.3125 0.0000
G 1 1.6250 -90.0000
1 3 1.8750 -90.0000
G 2 1.5000 -90.0000
2 1 0.2500 -90.0000
2 3 1.2500 -90.0000
3 F 3.1250 -90.0000
Another fault location? Enter 'y' or 'n' within single quote -> 'n'
Another fault location? Enter 'y' or 'n' within single quote -> 'n'
Enter Fault Impedance Zf = R + j*X in complex form (for bolted fault enter 0). Zf =
Another fault location? Enter 'y' or 'n' within single quote -> 'n'
Enter Fault Impedance Zf = R + j*X in complex form (for bolted fault enter 0). Zf = j*0.1
Another fault location? Enter 'y' or 'n' within single quote -> 'n'
TRANSIENT AND SMALL SIGNAL STABILITY ANALYSIS – SINGLE
PROGRAM :
X1 = 0.65; X2 = inf; X3 =
X2, X3)
b) Pm = 0.8; E = 1.17; V =
X2, X3)
eacfault
if exist('Pm')~=1
lse, e
X2 = input('Reactance during Fault in p.u. X2 = '); e nd
if exist('X3')~=1
X3 = input('Reactance aftere Fault in p.u. X3 = '); e lse, e nd
Pe1max = E*V/X1; Pe2max=E*V/X2;
Pe3max=E*V/X3; delta = 0:.01:pi;
if abs(cosdc) > 1
fprintf('No critical clearing angle could be found.\n')
else,
end
dc=acos(co
sdc);
else, end
Pmx=[0 pi-d0]*180/pi; Pmy=[Pm Pm];
d0=d0*180/pi; dmax=dmax*180/pi;
dc=dc*180/pi; x=(d0:.1:dc);
y=Pe2max*sin(x*pi/180);
y1=Pe2max*sin(d0*pi/180);
y2=Pe2max*sin(dc*pi/180);
x=[d0 x dc];
y=[Pm y Pm];
xx=dc:.1:dmax;
h=Pe3max*sin(xx*pi/180);
xx=[dc xx dmax];
hh=[Pm hPm];
delta=delta*180/pi;
if X2 == inf
d0r=d0*pi/180; dcr=dc*pi/180;
tc = sqrt(2*H*(dcr-d0r)/(pi*60*Pm));
else, end
else, end
%clc
h = figure; figure(h);
fill(x,y,'m')
hold;
fill(xx,hh,'c')
hold off;
OUTPUT:
a) To find tc enter Inertia Constant H, (or 0 to skip) H = 5
PROGRAM:
E=1.35; V=1.0; H=9.94; X=0.65; Pm=0.6; D=0.138;
f0=60; Pmax=E*V/X, d0=asin(Pm/Pmax)
Ps=Pmax*cos(d0)
wn=sqrt(pi*60/H*Ps)
z=D/2*sqrt(pi*60/(H*Ps))
wd=wn*sqrt(1-z^2),fd=wd/(2*pi)
tau=1/(z*wn)
th=acos(z)
Dd0=10*pi/180;
t=0:.01:3;
Dd=Dd0/sqrt(1-z^2)*exp(-z*wn*t).*sin(wd*t+th);
d=(d0+Dd)*180/pi;
Dw=-wn*Dd0/sqrt(1-z^2)*exp(-z*wn*t).*sin(wd*t);
f=f0+Dw/(2*pi);
subplot(2,1,1),plot(t,d),grid
subplot(2,1,2),plot(t,f),grid
subplot(111)
OUTPUT:
Pmax = 2.0769
d0 = 0.2931
Ps = 1.9884
wn = 6.1405
z = 0.2131
wd = 5.9995
fd = 0.9549
tau = 0.7643
th = 1.3561
LOAD –FREQUENCY DYNAMICS OF SINGLE- AREA AND TWO-
PROGRAM:
clear all;
clc;
Dpu=(D/rac);
Kp=(1/Dpu);
Tp=((2*H)/(f*Dpu));
delpd=cil/rac;
if r~= inf
B=(Dpu+(1/r));
else
B=(Dpu);
end
Fs=-(delpd/B);
OUTPUT:
Fs = -0.0196
OUTPUT:
Fs = -1
WITH GAIN
WITHOUT GAIN
FOR TWO AREA SYSTEMS
PROGRAM:
clear all;
clc;
rac1=input('Enter the value of Related area capacity-1 in MW:');
delptie=((B1*delpd2)-(B2*delpd1))/(B2-(a12*B1));
delptie=delptie*rac1;
fprintf('Steady state frequency deviation is : %g Hz\n',delf);
fprintf('System frequency :%g Hz\n',f);
fprintf('Change in tie line flow from area 1 to area 2 :%g
MW\n',
delptie);
OUTPUT:
PROGRAM:
clc;
clear all;
end
for i=1:n
den=den+(1/(2*a(i)));
end
num=pd+sum;
lamda=num/den;
for i=1:n
P(i)=(lamda-b(i))/(2*a(i));
end
for i=1:n
fprintf('Optimal Generation of unit %g: %g MW\n',i,P(i));
end
fprintf('Lamda: %g \n',lamda);
for i=1:n
unitcost=a(i)*P(i)^2+b(i)*P(i)+c(i);
fprintf('Generation cost of unit %g : %g\n',i,unitcost);
end
totalcost=0;
for i=1:n
totalcost=totalcost+a(i)*P(i)^2+b(i)*P(i)+c(i);
end
fprintf('Total generation cost : %g\n', totalcost);
OUTPUT:
Enter the number of units:3
PROGRAM:
clc;
clear all;
b =
zeros(n);
c =
zeros(n);
pmin=zeros
(n);
pmax=zeros
(n); p =
zeros(n);
sum
= 0;
den
= 0;
bm = zeros(n,n);
for i = 1:n
end
for i = 1:n
for j = 1:n
bm(i,j) = input('Enter B Coefficient : ');
end
end
sum = sum +
(b(i)/(2*a(i))); den =
den + (1/(2*a(i)));
end
lambda = (pd +
sum)/den; t = 1;
while t >0
fprintf('\nLambda is %g\n',lambda);
=
for i
1:n
p(i)
= 0;
end
pg = 0; pl
= 0; deldde
= 0; nb =
0;
for i = 1:n
for j = 1:n
if i~=j
nb = nb + bm(i,j)*p(j);
end
end
end
for i = 1:n
p(i) = (1 - b(i)/lambda - nb)/(2*(a(i)/lambda +
bm(i,i))); fprintf('Optimal generation of unit %g
is %g MW\n',i,p(i));
end
for i = 1:n
for j = 1:n
pl = pl + p(i)*bm(i,j)*p(j);
end
end
for i=1:n
if (p(i)>pmax(i))
p(i) = pmax(i);
elseif (p(i)<pmin(i))
p(i) = pmin(i);
else
p(i) = p(i);
end
end
for i = 1:n
pg = pg + p(i);
end
delp = pd + pl - pg;
fprintf('Change in load is %g\n', delp);
for i = 1:n
deldde = deldde + (a(i) + b(i)*bm(i,i))/(2*((a(i) +
lambda*bm(i,i))^2));
end
dellambda = delp/deldde;
fprintf('Change in Lambda is
%g\n',dellambda); lambda = lambda +
dellambda;
if delp<1
t = 0;
end
end
OUTPUT:
Lambda is 7.51099
Optimal generation of unit 1 is 26.511 MW
Optimal generation of unit 2 is 56.5225 MW
Optimal generation of unit 3 is 42.6028 MW
Power Loss is 1.20651
Change in load is 25.5702
Change in Lambda is 0.164165
Lambda is 7.67516
Optimal generation of unit 1 is 34.8985 MW
Optimal generation of unit 2 is 63.9613 MW
Optimal generation of unit 3 is 52.2555 MW
Power Loss is 1.68705
OUTPUT:
No. of Iterations = 7
Bus Voltage Angle ------Load------ ---Generation--- Injected