0 ratings0% found this document useful (0 votes) 112 views37 pagesSimulation in MATLAB PDF File
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
URN: 2ol2Xitos2”
Computer Simulation
Laboratory Journal
Department of Electrical Engineering
Bhilai Institute Of Technology
(Seth Balkrishan Memorial)
Bhilai House, Durg, (C.G.), 491 001 INDIA
B.
Phone (_ ): (0788) - 2323997, 2321163, Fax: (0788) 2210163Index
Exp. No
Name of Experiment
Page No.
Date of Performance
Sign
Write a Program for Computation of
Real Power, Reactive Power & Line
loss.
‘Write a Program To Plot V- Curve
and Inverted V-Curve,
Write a Program for Transmission
Line Parameter Calculation (Z, Y, A,
B,C,D).
Write a Program for Economic Load
Dispatch Calculation.
‘Write a Program for Transformer
Parameter Calculation.
Write a Program for Load Flow
Solution by Gauss Siedal Method.
g-1y
Write a Program for Load Flow
Solution by Newton Rephson
‘Method.
(= 2
Simulation of the performance of a
full wave bridge rectifier with RL and
RLE Load.
23-25
Simulation of Chopper controlled DC
Motor.
26-2Date:
AIM: Write a Program for Computation of Real Power, Reactive Power & Line loss.
REQUIREMENT: 1)P.C. 2) MATLAB.
PROGRAM:
cle clear
all
fprint£(*\n MENO\n!) fprint£(*\n 1.
Single Phase Power System\n') fprintf(‘\n 2. Three
Phase Power System\n') choice=input ("\n Enter the
choice of Power System: '); if(choice==1)
Rl=input ("Enter the Total Resistance of the Line(in ohms), RL= ')i
Veinput('Enter RMS Value of Voltage (in Volts), V= ')7
Ieinput ("Enter FMS Value of Current (in Anperes), I= ');
pfsinput ("Enter Power Factor, PF= ' ‘Loss=R1*I*
rf-sin(acos(pf));
P-V+I*p£; — Q=V*T*rf; fprinté(*\n
Active Power: $9 W\n',P); fprint£("\n
Reactive Power: %g VAr\n',Q)
fprintf('\n Line Loss: tg W\n’,1oss); end
if(choice==2)
Ri=input (‘Enter the Total Resistance of the Line(in ohms), RL= ');
Vi=input (‘Enter RMS Value of Line Voltage (in Volts), Vi= '
“input ("Enter RMS Value of Line Current (in Anperes), I= ');
pf=input ("Enter Power Factor, PF= ');
VeeVL/sazt (3); loss=3*R1*172,
rfsin(acos(pt)); Pesqrt (3) *VP+I4pf;
Qesqrt (3) +VP¥ Tere;
fprint#("\n Active Power: %g W\n',P);
fprant£('\n Reactive Power: 4g VAr\n',Q);
fprint#("\n Line Loss: 8g W\n',Joss)7 endEXPERIMENT NO,-2
Date:
AIM: Write a Program To Plot V- Curve and Inverted V-Curve,
REQUIREMENT: 1)P.c, 2)MATLAB
PROBLEM STATEMENT:
A SOMVA, 30-KV, three phase, 60 Hz synchronous generator has @ synchronous reactance
9 Q pet phase and a negligible resistance. Construct the V-Curve and the Inverted V-
Carve for the rated power of 40 MW with varying field excitation from 0.4 pf leading to 0.4
Pflegeing. Assume the open circuit characteristic in the operating region is given by:
E=20001V.
PROGRAM:
fprint£("\n V-CORVE & INVERTED V-CURVE PLOT\n\n")
printf (*INPUT:\n\n")
Be input ("Enter Real Power (in Mi), P=
‘Yr input ("Enter RMS Value of Line Voltage Power (in kV), V
input (‘Enter Synchronous Impedance (in ohms), 2 = ');
pf = input ("Enter Power Factor), PF = *):
3)
P= 40; % real power, Mi
V = v/sqrt (3)+ $40; § phase voltage, kV
2s = 3*2; & synchronous impedance
‘ang = acos(pf)s thetasang:~0.01:-angy & Angle from 0.4 leading
to 0.4 lagging pf
PFecos (theta) 7
P= Ptones(1,length(theta) );
8 generates P array of sane size
Tam = P./(3*abs(V)*cos(theta)); current magnitude kA
Ia = Iam.*(cos(theta) + j+sin(theta)); ® current phasor
B= V+ 29.*%a; # excitation voltage phasor
Bm = abs(B); * excitation voltage magnitude, kV
If = Bn*1000/20007 % field current, A
subplot (2,1,1) plot(If, Iam, k', "inewidth',2.5), grid
xlabel('Tf, At), ylabel('Ta, kh')
text (3.4, 1, "Leading pf"), text(13, 1,
text (9, .71, Ups") subplot (2,1,2)
plot (If,PF ,"k', "inewidth',2.5), arid
xlabel ('Tf, A"), ylabel('p£") axis ((2
28 0 1.5])
‘tagging pf")EXPERIMENT NO.-3
Date
AIM: Write a Program for Transmission Line Parameter Calculation (Z, Y, A, B, C,
D).
REQUIREMENT: 1)P.C, 2) MATLAB
PROBLEM STATEMENT:
‘A 345-KY, 60 Hz, three phase transmission line is 130 km long. The Resistance per phase is
(0.036 © per km and the inductance per phase is 0.8 mH per km. The Shunt Capacitance is
0.0112 pF per km. Use the medium line model to find the Transmission Line Parameters Z,
Y,A,B,C,D.
PROGRAM:
fprint£(*\n\n ‘TRANSMISSION LINE PARAMTERS CALCULATION\n*)
print? (*\nINPUT: \n\n")
x = input ("Enter line resistance (in Ohns per unit length); © =‘); L =
input (‘Enter line inductance (in Millitenry per unit length), b="),
C = input ("Enter line capacitance (in MicroFarad per unit length), © = ")
G = input ("Enter line conductance (in Siemens per unit length), 9 = ')7
£ = input ("Enter Frequency (in Hz) = ')i
Length = input (‘Enter Line length (in km) = ')
z= 4 + J#2*pit£*L/1000; Z = z#Length;
= g + j*24pir£+c/1000000;
y*Length;
= 14 24Y/2;
= 2;
G = ve(1 + 24¥/4); D = Ar
fprinté (*\n\nOUTPUT: \n\n")
fprint£(’Z\n $11.59 + 5', real(z)), fprinte(**-11.59', imagiZ))
fprint£("\nY=\n $11.59 + 5", real(¥)), fprinte('#-11.59', imag(¥))
ABCD = [A By CD); disp('
*) fprint£("\nABCD = \n!)
wpe
fprint£(* $11.59 + J", xeal(A)), fprintf(' 11.59", imag(A))
fprinté(' ¢-11.5g + 3", real(B)), fprint£(' 8-11.59 \n!, imag(B))
fprinté(* S-11.5g + 3", veal(C)), fprinté(’ 11.59", imag(C))
fprinté(’ @-11.5g + j', real(D)), fprint£(' @-11.5g \n', imag(D))
fprinté(* \n')EXPERIMENT NO-4
Dace
AIM: Write a Program for Economic Load Dispatch Calculation.
REQUIREMENT: 1)P,C, 2) MATLAB
PROBLEM STATEMENT:
‘The Fuel-cost functions for three thermal plants in Rs. /hr. are given by:
Cr= 500+5.3P,+0.004P;?
Cy= 40045.5P)+0.006P;
Cy 20045.8P;+0,009P,? where P,, P2 and Ps are in MW. The Total Load, PD, is 800
MW. Neglecting Line losses and generator limits, find the optimal dispatch and the total cost
in Rs. /hr.
PROGRAM:
clc; clear
ally
fprinté(*\n ECONOMIC LOAD DISPATCH\n") fprint£(*\nINPUT:\n")
neinput ("Enter the number of Units:');
alpharzeros(n)? beta=zeros(n);
ganma=zeros(n); for i=
fprint£("\nEnter the Cost Function Data for Unit $ \n", i)
ganma(i)=input ("Enter the value of gama= ');
beta(i)=Input ("Enter the value of beta= ');
alpha(i)-input ("Enter the value of alpha= '); end
pd=input ('\nEntex the value of Total Load Denand (in HW)= ')7
den=0;
ielin
sunesun+ (beta (i) /(2*gamma(i)));
end for i=l:
den=den+(1/(2*ganma(3)})7 end
for
num=pdtsum;
Yandacnum/den;
for ielin
P(i)=(lamda-beta(i))/(2*gamma(i)); end
fprintf (*\nOUTPUT:\n")
fprintf('\nbamda: g ',lamda); for
ielin
fprint€("\nOptimal Generation of unit ég: $9 MW", i,P(i))7
end fprintf("\n"); for dele
unitcost=gamma (i) *P(i)“2tbeta (i) "P(t)+alpha (i);
fprint£("\nGeneration cost of Unit %g : Rs. %g',i,unitcost);
end totalcost=0; fprinté("\n"); for inl:
totalcost=totalcost+gamna(i)*P (i) *2+beta (i) *P(i)+alpha(i);
end fprintf('\nfotal generation cost : Rs. 9 \n!,
totalcost)7EXPERIMENT NO--5
Date:
AIM: Write a Program for Transformer Parameter Calculation,
REQUIREMENT: 1)P.C. 2) MATLAB
PROBLEM STATEMENT:
Data obtained from short circuit and open circuit tests of a 240-KVA, 4800/240-V, 60-Hz
transformer is:
Open-Circuit Test (from h.v. side): V\= 240 V; Io=10A; Po=1440 W
Short-Cireuit Test (form Lv. side): Vsc= 187.5 V; Isc=50A; Psc=2625 W
Determine the Parameters of the Equivalent Circuit,
PROGRAM:
cle clear
all;
fprint£("\n ‘TRANSFORMER PARAMETER CALCULATION\n\n') fprinté (INPUT:
\n')
S = input (' Enter Transformer rated power in kVA, § = ');
Biv = input(" Enter rated low voltage in volts = ');
Bhv = input (' Enter rated high voltage in volts = ');
fprint£(*\n Open circuit test data \n\n') fprintf(’
Ant) ts0 = 0;
1 & stromp(tso, 'LV')~=1 stromp(tso, ‘hy')==1 &
while stremp(tso, '1v'):
stromp(tso, 'HY!')~=1
fprint£(" Enter ''lv'" within quotes for data referred to low side
or \n')
tso = input (' enter ‘'hv'' within quotes for data referred to high
side -> ')
Af stremp(tso, '1v')~=1 & stremp(tso, 'LV')-"1 & stremp(tso,
Thy')~=1 @ stromp(tso, 'HV!)~-1
fprint£("\n Incorrect reply, try again \n\n'),
‘end end
Vo = input(! Enter input voltage in volts, Vo = ');
Zo = input (' Enter no-load current in Amp, Io = ');
Po = input(’ Enter no-load input power in Watt, Bo = ");
Re = (Vo)*2/P07
Te = Vo/Re?
if To >
To
fprintf(' Error, Ie > To. Inconsistent test data. Check test data
and try again’); return, end
Im = sqrt (Io*2 = 1c*2)7 Xm
= Vo/In;
if tso == '1v' | tso == ‘Lv!
Rely = Re; Xmlv = Xm;
Rehv = (Bhv/Elv)*2#Ro; Xmhv = (Bhv/Elv)*2*xm;
else, end if tso == ‘hv’ | tso == ‘HV
Rehv = Re; Xmhv = Xm7
Rely = (Elv/Ehv)*2*Rc; Xmlv = (Elv/Ehv)"2*%m; else,
endfprintf("\n Short circuit test data \n")
forint t(' =~ senceenennnaunm \n!) 8090;
unile stromp(tsc, ‘1v!)--1 & stremp(tsc, ‘LV')~=1 & stronp(tsc, ‘hy')~=1 &
-stromp(tse, "RV')~=1
fprint£(" Enter ‘*1y!! within quotes for data referred to low side
tec = ool enter "Yhy!* within quotes for data referred te high
side >);
if scents aint & stremp(tsc, 'LV')~91 & stremp(tsc,
ny!)==1 & stronp(tse, "HV?)=n1
forinte('\n Incorrect xeply, try again \n\n'),
end end
Vsc = input (" Enter reduced input voltage in volts, Vse = ‘)/
data. Check test data
Bey —ele/ebnA
fprinté(‘ourpoT: \n!)
fprinté('\n shunt branch zef, co LV side ') fprinté(’
Shunt branch ref. to AV side \n!)
B) fprints(” 2:3f oha',, Rely), Sprint#("
7 912.3¢ ohm \nty)
1 kmlv), fpeints(
fprint£(*\n Seriéajbranch ref. to LV side ") fprintt
series branch ref. fo AV side \n")
Eprints(’ Ze = 810/66", real(zelv)), fbx! F 4 $10.6 o
‘Zel= 410. (gehy)), fprinté(’ + 4 #10.6f ohm \n\n",
: oeEXPERIMENT NO-6
Date:
AIM: Write a Program for Load Flow Solution by Gauss Siedal Method.
REQUIREMENT: 1)P.C, 2) MATLAB
PROBLEM STATEMENT:
‘Obtain the Power Flow Solution by the Gauss Siedal Method for a 5- Bus System whose data
is given below:
Bus Data:
‘Bus Bus Volvage Angle ------Load---- ------Generator-------— Injected
No code Hag. Degree MN var © MM var Guin Quax var
11 1.06 0.0 0,0 0,0 00 00 0 0 0
2 2 1.043 0.0 21.70 12.7 40.0 0.0 49 $0 0
OO) ao af AA Oo OM ob O° 9
40 106 0.0 7.6 16 00 00 0 0 0
5 2 1.01 0.0 94.2 19.9 0.0 0.0 4 40 0
Line Data:
Line code
Bus bus = -R x V2B = 1 for lines
alo nr p.w. Pee Pile >dor< itr. tap at bus al
1 2 0.0192 0.0575 0.02640 1
2 3 0.0452 0.2852 0.02040 1
2 4 0.0570 0.1737 0.01840 1
3 4 «0.0132 0.0379 0.00420 a
2 § 0.0872 0.1983 0.02090 1
PROGRAM:
ele
clear
fprint£("\n LOAD FLOW SOLUTION USING GAUSS SIEDAL
MeTHOD\n\n'); basemva = 100; accuracy = 0.001; maxiter = 107
fprint£("\n BUS DATA\n\n");
fprint£('Bus Bus Voltage Angle ~~.
=s- Injected\n'); fprintf('No code Mag. Degree i! Mvar
Wi Mvar Onin max Mvar\n\n'); fprintf("1 1 1.06 0.00.0 0.0 0.0 00 09 0 oO
11043 0.0 21.70 12.7 40.0 0.0
fprintf(’3 0 1.0 0.0 2.4
dp gprinte('2 2
40 50 O\n")7
2
0 O\n"); fprinte("4 0 1.06 0.0 7.6
0.0 0 0 O\n"); fprinte(*5 2 1.01
19.0 0.0 0.0 -40 49 —O\n"); busdata=(1
0.0 0.0 0.0 0.0 0.0 0 0 0
1.043 0.0 21.70 12.7 40,0 0.0 -40 50
Bo 1.0) MONG) 204)cuda2 8 010) (0-0) 0
40 1,06 0.0 7.6 1.6 0,0 0.0 0
5 2 2.01 0.0 94.2 19.0 0.0 0.0
fprint£("\n
LINEDATA\n\n‘); fprintt(’\n
Line code\n\n'); fprintf("Bus bus x 2B =
1 for lines\n'); fprintf() nl nz p.u. paws pow 2
Lor <1 tr, tap at bus nl\n'); fprintf(' 1 2 0.0192 0.0575
0.02640, T\n'); fprinte(' 1 30,0852 0.1852 0.02080
1\n'); fprintf(! 2 4 0.0570 0.1737, 0.01840 3\n");
fprints(? 3 4 0.0132 0.0379 0.00420 2n)7
fprintf(’ 2 5 0.0472 0.1983 0.02090 2\n")
Linedata=(1 2 0.0192 0.0575 0.026401 ae)
0.0452 0.1852 0.02040 2
2 4 0.0570 0.1737 0.01840 1
3 4 0.0132 0.0379 0.00420 1
2 5 00,0472 0,1983 0.02090 1);
QThis part obtains the Bus Admittance Matrix for power flow solution.
frsart (-1)7 4 = sqrt(-1)s
nl = linedata(:,1)7 nr = linedata(:,2)7 R=
linedata(:,3); X = linedata(:,4)7 Bo =
j+linedata(:,5)7 a = linedata(:, 6)?
Abr=length(linedata(:,1)); nbus = max(max(nl),
maxinr))}) 2 = R + 39%; y= ones(nbr,1)./27
Sbranch adnittance for n= l:nbr
if a(n) <= 0 a(n) = 1; else end
Yous=zeros (nbus, nbus) + @ initialize Ybus
to zero 8 formation of the
off diagonal elenents for kelinbr7
‘ybus (nl (k) nz (k) ) mYbus (nl (ie) me ())—
yk) /a(k)
Yous (nx (K) ,nl.(k)) =Ybus (nl. (k) RE (HK) ) 7
enda
& formation of
diagonal elenents for nel
for k=l:nbr if ni (k)=
Ybus (n,n) = Ybus (n,n) +y(k) /(a(k)°2) + Be(k)
elseif nr(k)=en
Ybus (n/n) =
Ybus(nyn)-+y(K) +Bo(k);
else, end end end
srnis part obtains the power flow solution by Gauss
Siedal Method
Vme0; delta-0; yload-0;
deltad =07 bus =
Length (busdata(:,1))7 for
kelinbus n=busdata (ky 1);
b(n) =busdata (k,2)7 U(n)=busdata(k,3); delta(n)=busdata(k, 4):
Pd(n)=busdata (i, 5); Gd(n}=busdata(k,6); Pg(n)-busdata(k,7)7 Qg(n) =
e@ usdata (ke 8)
Qnin(n)=busdata(k, 9)7 Qnax(n)=busdata(k, 10);
Qsh(n)=busdata(ke, 11)7
Ee vin) <= 0 Vm(n) = 1.0; Vin) = 2+
j*0; else delta(n) = pi/180*delta (n);
Vin) = Vmin)* (cos(delta(n)) + J#sin(delta(n)));
P(n)=(Pg(n)-Pd(n)) /pasemvaz
Q(n)=(Qg(n)-Qd(n)+ Qsh(n)) /basemva;
Sin) = P(n) +
4s0in); end
Dv(n)=0; end
fun = 0} AcusBus = 0; converge = 17
Vo = zeros (nbus, 1) +j*zeros (nbus, 1); Sc = zeros(nbus,1)4+)*zeros (nbus,2) 7
while exist (‘accel’)
accel = 1.3;
end
iters07
maxerror=
10;
while maxerror >= accuracy 5 iter
r <= maxiter itersitertl; for n =
bus; YV = 0#3*03 for Lb =
mbr? if nl(b) == n,
kenr(L) 7 w= w+
Yous (n, k) *V(k)? elseif
ne(L) S= ny kenl(); w
= YV + Ybus(n,k)*V(k)?
end
end
Se = conj(V(n))*(Ybus(n,n)*V(n) + YV) ;
se = conj (Sc);
DP(n) = Pin) ~
eal (Sc)? Doin) =
Q(n) = imag(Se);
if k(n) == 1
P(n) = real(Sc); O(n) = imag(Sc);
DP{n) =03 DO(n)=" Ve(n) = V(n);
elseif kb(n) == 2
10
aQ(n) = imag(se); s(n) = Pin) + 5*Q(n);
if Qmax(n) = 0
Qge = Q(n)*basenva + Odin) - Qshin);
Af abs (DQin)) <= .005 & iter >= 10 8 After 10
iterations if DV(n} <= 0.045 & the
Mvar of generator buses are Af age < omin(n},
& tested. If not within limits Vm(n) Vmin) =
Ym(n) + 0.005; % is changed in steps of 0.005 pu
DV(n) = DV(n) +.005;
elseif age > Qnax(n),
Vm(n) = Vm(n) = 0.005;
& up to .05 pu in order to bring
4 the generator Mvar within the
% specified limits.
Dv(n)=DV(n)+. 005; end else, end
else, end else, end end if xbin)
Ve(n) = (cong (S{n) ) /conj (Vin) - ¥V )/
Ybus (n,n) i else, end if
b(n) == 0
Vin) = Vin) + accel*(Ve(n)-
vin); elseif kb(n) —= 2
Ver = imag(ve(n))2
VeR = sart(Yn(n)*2 ~ Ver*2);
Ve(n) = Ver + $*Ve:
Vin) = vin) +
accel*(Ve(n) =Vin)); end
end
maxerror-max( max(abs(real(DP))), max (abs (inag(0Q))) 17
if iter == maxiter & maxerror > accuracy
fprint£(‘\nWARNING: Iterative solution did not converged after
") _ fprint£("tg', iter), fprintf(* iterations. \n\n")
fprintf ("Press Enter to terminate the iterations and print the
results \n') converge = 0; pause, else, end
end cle.
if converge
“1
tech= (1 Power Flow Solution by Gauss-Seidel
Method’); else, tech=(* Fower Flow
Solution by Gauss-Seidel Method"); end
X=0; for
n= linbus
Vm(n) = abs (V(n)); deltad(n) = angle(V(n))*180/pi;
if kbin) = 1
S(n)=P(n)+3*Q(n)7
Pg(n) = P(n)*basemva + Pd(n);
Qg(n) = Q(n)*basemva + Odin) -
Qshin)s
kekt1;
Pag(k)=Pg (n) +
elseif b(n) ==2
keke;
Pog (k)=Pg(n) 7
‘S(n)=P(n)+340(n) 7
Qg(n) = Q(n)*basemva + Qd(n) =
Qsh(n)¢ end
yloadin) = (Pd(n)—
340d (n)+3*Qsh (n))/(basemva*Vm(n)"2); end
Bgt = sum(Pg); Qgt = sum(Qg); Pdt = sum(Pd); Qdt = sum(Qd);
Qsht = sum(Qsh); busdata(:,3)=Vm'; busdata(:,4)=deltad';
clear AcurBus DP DQ DV L Sc Vc VcI VcR YW converge delta
12This part prints the power flow solution on the screen
Maximum Power Mismatch = tg \n',
No. of Iterations =
=-===-Load-=:
Degree
disp(tech)
fprinté("\n
maxerror) fprint£ |”
iter) head =(' Bus Voltage Angle
‘Injected’ 1 "No. Mag.
Mar Mvar *
_'}) disp(head) for n-i:nbus
fprint£(* $7.32",
___ fprinte(" 85g";
fprintf(" %8.3£", deltad(n)),
Eprinté(" $9.3", Pa(n)), “fprint£(’ $9.36",
Qd(n)), fprinte(" $9.36", Pgin)),
fprintt(' $9.3 %, ggin)), Pe $8.3\a",
Qsh(n)) end si ae
soripealy afprintf(' ~-bine-- Power at bus & Line flow
Transformer\n') fprint£(’ from to MW
Mvar tap\n")
for n= linbus busprt = 0; for L = Linbry Af busprt
9 fprinté(" \n'), fprintf('b6g', n), fprinté('
38", P(n) *basemva) fprint£('$9.3£", Q(n)*basenva) ,
fprint£("$9.3£\n', abs (8 (n) *basemva) )
busprt = 1;
else, end
Af nl (b)e=n k= ne(L);
In = (V(n) = a(b)*V(k))*y(L)/a(L)*2 + Be(L) /a(L)*2*V(n) 7
Tk = (WGK) = Vin) /a(L))*y(L) + Be(L)*V(k) 7
Snk = V(n)*conj (In) *basenva;
‘Skn = V(k)*€0n3 (7k) *basenva;
SL = snk +
SLT = sur
elseif nr(b)==n k = ni(
In = (V(n) ~ V(k)/a(L))*:
Tk = (W(K) = a(L)*Via))
Snk = V(n)*conj (Ir
Skn = V(k)*conj (II
Su = 0k + ShayEXPERIMENT NO.-7
AIM: Write a Program for Load Flow Solution by Newton Raphson Method.
REQUIREMENT: 1)P.C, 2) MATLAB
PROBLEM STATEMENT:
Obtain the Power Flow Sotution by the Newton Raphson Method for a 5- Bus System whose
data is given below:
Bus Data:
Bus Bus Voltage Angle -~--=-Load---- ------Generator-——----~ Injected,
Wo code Mag, Degree MN Mvar Wi Mvor Quin Qua Hvar
12 1,06 00 0.0 0.0 0.0 00 9 0 0
2 2 1,08 00 21,70 12.7 40.0 0.0 40 $0 0
3/0) d:olmy ovo ava)uia-2iet0v0) Ne cta)iee 01) 00).
40 1,06 00 76 1.6 00 00 0 0 ©
$ 2 1.01 0,0 94.2 19.0 0.0 0.0 -0 40 0
Line Data:
Line code
Bus bus X 4/28 = 1 for Lines
nl nr pu. pe. pale «> Lor <2 tr, tap at bus nl
1 2 0.0192 0.0875 0.02640 1
1 3 0,0452 0.1882 0.02040 1
2 4 0.0870 0.1737 0.01840 1
3 4 0.0182 0.0379 0.00420 1
, 2 8 0.0872 0.1983 0.02090 1
PROGRAM:
ele
clear
fprint£(*\n TOAD FLOW SOLUTION USING NEWTON RAPHSON
METHOD\n\n"); basemva = 100; accuracy - 0.0017 maxiter = 10;
fprinté('\n BUS DATA\A\n");
fprintf (‘Bus Bus Voltage Angle -~----Load: --Generator-
=== Injected\n'); fprintf("No code Nag. Degree Mil Mvar
mw Mvar Qmin Qmax Mvar\n\n'); fprintf("1 1 1,065 0.0
0.0 0.0 0.0 0.0 0 © O\n"); fprinte('2 2
141.043 0.0 21.70 12.7 40.0 0,0 -40 «50.0
fprinte('3 0 “1.0 "0.0 2.4 1.2 0.0 0.0 0
Q Own) Sprintzird 0 1.06 0.0 716 1.6 0.0
0.0 0 O\n')s fprinté('s 2 1.01 0.0 94.2
2.0, ommmelal tees ast) busdatan(2 1 1,06
0.0 0.0 9.0 0.0 0 0 Lae
0:0 21,70 12:7 "40.0" 0.0 -40 50 o
10 cH mer ga8io1t.01. 0), @ 0
1,06 0,0 7.6 1.6 0,0 0.0 o
2 tor 94.2 19.0 0,0 0.0 -40 40 ols
fprinte(*\n
LINEDATA\n\n');_fprint£(\n
Line code\n!
x ie st
nl one pale Bete ite >
1\n'); fprinte’ 12" "0,0182." 0.0575
or tate 230.0452 0.1852 0.02040
4, 0: 0570,, 003737 O.01040. | aint
nt);en
a
% formation of the
diagonal elemente for neLenbus
for kelinbr Af ni (k)s=n
Ybus(nyn) = Ybus(nyn)+y(k)/(a(k)*2) + Bo(k) 7
elseif nr(k)m=n
Ybus(n)n) =
Ybus (non) +y (ik) +B (i) +
else, end end end
Tic part obtains the power flow solution by Newton Raphson Method
nis=07 ng=0; Vm=0,
deltad-0; nbus
Jength(busdata
n=busdata (ke, 1);
Kb (n)=busdata(k, 2); Vin(n)=busdata(k, 3); delta(n)=busdata(k, 4);
Pd(n)=busdata(k,5); Qd(n)=busdata(k, 6); Pg(n)=busdata(k,7); Ogin) =
Dusdata(k, 8)7
Qmin(n)=busdata(k, 9); Qnax(n)=busdata(k, 20);
Qsh(n)=busdata(k, 11);
if Vain) <= 0 Vain) = 1.0; v(n) = 1 +
50; elise delta(n) = pi/180*delta(n|
Vin) = Vm(n)*(cos(delta(n)) + 3*sin(delta(n)));
P(n)=(Pg(n)=Pd(n)) /basemva;
Q(n)=(Qg(n)=Od(n) + Qsh(n)) /basenvay
S{n) = Pin) +
J#ain); end end for
kel:nbus if kb(k) == 1, ns =
nst1; else, end if kb(k)
2 ng = ngti; else, end
Bgs(k) = ngy nsa(k) = ns7
Yaeabs (Yous); t =
angle(Ybus);_ me2*nbus—
ng-2*ns; maxerror = 1;
converge=1; iter = 0;
§ Start of iterations
clear A DC 3 DX
while maxerror >= accuracy & iter <= maxiter § Test for max.
Power mismatch for imi:m for kel:m
Ali, k)=0; Binitializing
Jacobian matrix end, end iter =
itert1; for n=1:nbus
deltan(
7 yload~0;
1); for ke1:nbus
nnen-nss(n);_Imenbustn-
ngs (n)=nss(n)=ns; 11:
J22-0; I33-0; TA4=0) for
i=i:mbr, Af nl(i) =n |
nr(i) == if nl (i) ==
n, 1 = nr(i); end if
ne(i) =n, 1 = nl(i); end
J11-J11+ Vm(n)*Vm(1) *¥m(n,1)¥sin(t(n,1)- delta(n) +
delta(1))7 033=J33+
Ym (n) *Vm(1)*¥m(n,1)*cos (t (n,1)- delta(n) + delta(1));
Af kb(n)~=1
J22=d22+ Vm(1)*Ym(n,1)*cos(t (n/1)- delta(n)
+ detta(i))}; Tadd
Vm(1)*¥m(n,1)*sin(t(n,1)= delta(n) + delta(i));
else, end 4f ko(n) = 1 & kb(1) ==
Uk = nbus+1-ngs (1) -nss (1) -ns; ei.
nss(1);
16& off diagonalelenents of v1
A(nn, 11) =-Vm(n)*Vm(2) *¥m(n, 1) #ain (t (n,1)- delta (n)
+ delta(1)); Af kb(1) § off diagonal
elements of J2
Ann, Lk) =Vm(n) *¥m(n, 1) #cos(t(n,1)~ delta(n) +
deita(1));end if kbin) == 0 off diagonal
elenents of 53
A(im, 11) =-Vm(n) *Vm(1)#¥m(n,2) *cos (t (ny 1)~
deita(n)+delta(1))} end Af kb(n) == 0 @ kb(1) == 0
8 off diagonal elements of 34 A(Im) 1k) =
Vm(n)*¥m(n, 1) *sin(t(n,1)= delta(n) + delta(1)) rend else
end else , end "end
Pk =
Vm (n)*2*Ym(n, n) *cos(t (ny n)) +933;
Qk = -Vmin) "2*Y¥m{n,n) ¥sin(t (n/n) )-
341;
if kb(n) == 1 P(n)=Pk; Qin) = Qk; end &
Swing bus P Af b(n) == 2 Q(n)=Ok7
Af Qmax(n) ~= 0
Qgc = Qin) *basemva + Qdin) - Qshin);
if iter <7 4 Between the 2th &
6th iterations if iter >2 % the
Mvar of generator buses are 4£ Qge < Qninin),
& tested. If not within limits vm(n) vm(n) =
Vmin) + 0.01; 4 is changed in steps of 0.01 pu to
elseif Qg¢ > Qnax(n), % bring the generator Mvar within
Vm(n) = Vm(n) = 0.01;end $ the specified limits.
else, end
else,end
e1se,end end
Lf kb(n) -= 1
‘A(nn,nn) = J11; diagonal elements of Ji
Do(nn) =
P(n)=Pk; end
if kbin) == 0
‘A(nn, 1m) = 24Vm(n)+¥m(n,n)*cos(t (nn) )4J227 diagonal elements of J2
A(Im,nn)= 533; diagonal elements of J3
A(1m,1m) ==2+Vm(n)*¥m(n,n)*sin(t(n,n))-g44; ¢diagonal of elements of J4
De(1m) = Q(n)-Qk;
end end DX-A\DC'; for:
n=1:nbus — nn=n-nss(n);
Amenbustn-ngs (n) -nss (n)-ns;
Lf kb(n) ~= 1 delta(n) =
delta(n)+DX(nn); end if
Kb(n) == 0
Vm(n)=Vm(n)+DX(1m)7 end
‘end.
‘maxerror=max (abs (DC))
if iter == maxiter & maxerror > accuracy
fprintf('\nWARNING: Iterative solution did not converged after
") fprint£("sq', iter), fprinté(' iterations. \n\n')
fprintf("Press Enter to terminate the iterations and print the
results \n") converge = 0; pause, else, end
end
fprintf("\n\n Hit return to
continue \n') pause cle if
converge ~= 1
vtechs (* ITERATIVE SOLUTION DID NOT
CONVERGE"); else, tech=(" Power Flow
Solution by Newton-Raphson Method'); end
ve
Vm, *cos (delta) +3 *Vm. *sin (delt
a); deltad=180/pirdeita;
isegrt (-1); ke0) for a
bus if kb(a) == 1
keke];
S(n)= Pin)+4*o(n)
Pg(n) = P(n)*basemva + Bd(n);
Qg(n) = Q{n)*basenva + Qdin) - Qshin);
Pgg(k)=Pg(n)
gg (k)=Og(n) 7
june 97 elseif
kb(n) ==2 Keke;
'8(n)=P(n)+3*O(n);
Qg(n) = 0(n)*basenva + Qdin) - Qshin):
Pog (K)=2g(n) 7
gg (k)=03(n); § June 1997
end
yhoadin) = (edin)-
3*Qd(n)4j+Qsh(n}) /(basemva*¥m(n) 42); end
busdata(?,3)=Vmn'; busdata(:,4)=deltad';
Pgt = sum(Pg); Qgt = sum(Qg); Pat = sum(Pd); Qdt = sum(Qd);
Qsht = sum(Qsh);
&clear A DC DX 11 422 933 J44 Qk delta 1k 11 Im
Sclear ADC DX J11 J22 933 Qk delta 1k 11 Im
‘This part prints the power flow solution on the screen
disp(tech)
fprinté(* Maximum Power Mismatch = tg \n",
maxerror) fprintf(* No. of Iterations =
Sg \n\n', iter) head =[' Bus Voltage Angle ==----Load~:
-Generation- Injected’ "No. Mag. Degree
Mvar MH Mvar Mvar * Q
"}; disp(head) for n=1:nbus
fprint#(" ¥5g’, n), fprinte(' $7.36",
va(n)), fprintf(" $6.3f", deltad(n)),
fprint£(’ $9.36", Pd(n)), fprint#(" 9.36",
Qdin)), fprinte(" $9.38", Pg(n)),
fprintf(" 89.3f ", Qg(n)), fprintf(" $8.3¢\n',
Qsh(n)) end
fprintt(" \n'), fprintf(" Total i
fprint#(" 89.38", Pdt), fprintf(* $9.36", Odt), fprint£(?
49.36", Pot), fprintf(' $9.3f", Got), fprintf(* ¥9.3f\n\n",
Qsht) 7
fprintf(*\n\n Hit return to continue
\n!) pause
&This part computes the line flow
and losses cle SLT = 0;
fprintf('\n")
fprintf(* Line Flow and Losses \n\n')
fprintf(* -Line-- Fower at bus & line flow --Line loss
‘Transformer\n') fprintf(' from to MW Mvar NVA ow
Mvar tap\n")
18for n= Linbus
busprt = 07
for L = l:nbr;
if busprt == 0
fprintf(' \n'), fprint£(*¥6g", n), fpeintf(" 49.38",
P(n) *basenva) fprint£("89.32", Qin) *basenva), fprinté($9.3£\n',
abs(S(n) *basenva) )
busprt = 1;
else, end &
Af nlismen = mrt)
In = (Vn) = a(L)¥V(e)) *y() /a(L)%2 + Be(L) /a(L)~24V(n)?
Th = (VO) = Vin) /a(L)) *y(L) + Be(L) *v(K)2
Snk = Vin) (Gn) tbasenvayEXPERIMENT NO.-8
Date:
AIM: Simulation of the performance ofa full wave bridge rectifier with RL and RLE Load,
REQUIREMENT: 1)P.C. 2) MATLAB-SIMULINK.
PROCEDURE:
A. Bull Wave Bridge Rectifier with RL Load
Ost oo to create mode] by using Simulink:
Click on File then New then Model.
2 on resulting window click on ,Library Browser", a Simulink Library Browser will
appear.
3. Make/Model the circuit by placing all its Blocks from its comesponding
Library/toolbox, which is clearly shown in the table 1. Right click on the block to
rotate mirror etc. to organize the circuit elements,
4, To get any of the elements in series RLC branch, such as R & L, click on ,Series RLC
Branch" block in the ,,SimPower System/Element library", and enter the parameters
value in such a way that other element C is invisible, That is to eliminate capacitance
ofthe branch; the R, L and C values must be set to ,inf".
5. To change the circuit parameters applicable to the block by double clicking on the
block/element and type the values. Keep the values default for some blocks like
Thyristor, Diodes, MOSFET ete.
6. To measurelobserve the voltage across or current passes through the electrical
block/device, connect ,,Voltage Measurement” or Current Measurement” blocks
respectively with the electrical block, itis available on the Library-
+»SimPowerSystem/Measurement".
7. To observe the waveform in figure window, scope block is connected with ,,Voltage
Measurement" and ,Current measurement" blocks, This scope block is available by
clicking on Library Browser then clicking on ,Simulink* then click on Source"
thereafter clicking on ,Scope”.
8. For “Single phase full controlled Bridge rectifier with RL load”, components required
and its parameter values are similar to that of RLE load, except E parameters, That is
the ,DC Voltage Source" is removed from the schematic. The schematic arrangement
is shown for RI Load.
9. Before simulating the circuit, ensure that all the blocks are connected properly. The
‘most common error encountered is floating node". This usually means that there is
some problem in interconnects.
DD Steps to simulating the circuit by using Simulink:
1. After correcting all floating node errors start by creating a simulation.
2, Click on Simulation, and then click on ,Configuration Parameters" and make sure
that solver option is ,ode23tb’s it is essential when circuit contains power system or
power electronics tools. And the stop time value should be 5/50 for S0Hz supply
20ae
frequency for five cycles, For ,n" number of cycles, stop time would be n*(1/50) for
S0Hz supply, where n=1, 2, 3.... and also set Max Step Size to le-5 and Min Step
Size to 1e-6,
. To run the simulation, select ,Simulation' then click on Start".
|. If any errors are reported here. Correct the schematic or the simulation settings and
rerun simulation,
Table 1
>
Components Teal Bax? L Block (parameters
| AC Velage | Simpower: 7 RC
| aE ‘Stmpower Systems7—|_Thyristor
Crue | PowerElecrenkcs
[eee Se So woorsareaT
Se ee | eco —
| Rabon Samaiink Aaa ‘Ralanonal
(Operator ‘Operations Operator
‘Qmmmbers)
Constant | Stnalink 7 Sources Constant
Fowier ‘Sampower Fourier
Systemna/Exza
I iteary/Measmements
Toad Sees RIC =10
‘Simpower Sysems/ Rexisamee(Otm)
Elements = | 9 Branch
‘Capacitance(F) =int
create model by using Simul
Click on File then New then Model.
2. On resulting window click on ,Library Browser", a Simulink Library Browser will
appear.
Make/Model the circuit by placing all its Blocks from its corresponding
Library/toolbox, which is clearly shown in the table 2. Right click on the block to
rotate mirror etc. to organize the circuit elements,
To change the circuit parameters applicable to the block by double clicking on the
block/element and type the values. Keep the values default for some blocks like
Thyristor, Diodes, MOSFET ete.
To measure/observe the voltage across or current passes through the clectrical
block/device, connect voltage measurement or current measurement blocks
respectively with the electrical block, it is available on the library ,SimPower
System/Measurement,
To observe the waveform in figure window, scope block is connected with ,,Voltage
Measurement" and ,Current Measurement" blocks. This scope block is available by
click on ,,Library Browser" then ,Simulink/Source then ,Scope". ‘The Schematic
arrangement is shown for RLE load.
Pr. After correcting all floating node errors start by creating a simulation,
Click on .,Simulation' then click on ,Configuration Parameters" and make sure that
solver option is ,ode23tb", itis essential when circuit contains power system or power
electronics tools. And the stop time value should be 5/50 for 50Hz supply frequency
for five cycles. For ,n" number of cycles, stop time would be n*(1/50) for S0Hz
supply, where n=1, 2, 3.... and also set Max Step Size to le-5 and Min Step Size to
1e-6,
3. To run the simulation, select ,,Simulation' then ,Start"
. Ifany errors are reported here. Correct schematic or the simulation settings and re-run
simulation.
To view simulation plots on simulation window, double click the scope in the
‘schematic. The ,,Scope" block corresponding to ,,Voltage Measurement" and ,,Current
MeasuremsTable 2
“Bier aT
AG vonage | Peak AenplitedeGy 250° =aAD
somce” | Phase(aeg =O
requencyGis) “50
Tineisor
G@onmbers) | Detvatt
Repeating | Time Values = [0001 001 002]
Sequence | Output Values = [05 0:
Bepistag —] Pine Vators = 100.01 905002] —] 1 07 OT
Semsence | Output Vanes ~[00 51
Fabtioasl —| Greater ties or equal ©
saat equal to OP
Ginter)
‘Coastaat | Conrtaay Vals (For Contot
a i ee
Senses Value = 200 or Torque)
Fourier | Fundamental Fieq: 50°
‘Hiemenie: 0
Series RIC | Resistance(ORa) 10
Tnductance(ED —SeO3
Copactance iat
DC Nachme | Desait
| Slinpower Synems7—| Discrete Mean Foadamens = 307
‘Mean Vaive | Evara Library! Vaive ‘Geemaining Parameters Defi)
2BEXPERIMENT NO.-9
Date: =e,
AJM: Simulation of Chopper controlled DC Motor, REQUIREMENT:
1)P.C, 2)MATLAB-SIMULINK
PROCEDURE:
* Steps to create model by using Simulink:
1, Click on File then New then Model.
2, On resulting window click on ,Library Browser", a Simulink Library Browser will
appear.
3. Make/Model the circuit by placing all its blocks from its corresponding
Library/toolbox, which is clearly shown in the table 1. Right click on the block to
rotate mirror etc. to organize the circuit elements.
4, To change the circuit parameters applicable to the block by double clicking on the
block/element and type the values. Keep the values default for some blocks like
Thyristor, Diodes, MOSFET etc.
5. To measure/observe the voltage across or current passes through the electrical
block/device, connect ,,Voltage Measurement" or ,Current Measurement” blocks
respectively with the electrical block, it is available on the library ,.SimPower
‘System/Measurement”.
6. To observe the waveform in figure window, Scope" block is connected with
Voltage Measurement" and ,,Current Measurement" blocks. This ,Scope" block is
made available by clicking on Library Browser’ then ,,Simulink/Source" then
‘»Scope'. The Schematic arrangement is shown for “Chopper controlled DC Motor”.
: sim circuit by using Simulink:
1. After correcting all floating node errors start by creating a simulation.
2, Click on , Simulation” then click on Configuration Parameters" and make sure that
solver option is ,ode23tb", it is essential when circuit contains power system or power
lectronics tools. And the stop time value should be 5/50 for SOHz supply frequency
for five cycles, For yn number of cycles, stop time would be n¥(1/50) for SOHz
supply, where n=1, 2, 3.... and also set Max Step Size to auto and Min Step Size to
auto.
. Torun the simulation, select ,Simulation' then select Start".
Tfany errors are reported here. Correct schematic or the simulation settings and re-run
simulation.
BY
5. To view simulation plots on simulation window, double click the Scope” in the
‘schematic, The ,Scope" block corresponding to ,,Voltage Measurement" and ,,Current
Measurement" blocks gives voltage and current waveforms respectively with respect,
to time.
24Table 1
‘Components “Tool Box? Block parameters
Ubrary browser
DC Voltage | SimpowerSystems’ | DC voltage | Amplitude(v) =360
Source Electrical sources, coue
GTO__| Simpower Systems 7 CIO
Power Electronics (umber) | Defutt
et Repeating | For S000 iz Ge. ae7—)
Time Values = [0 2e-4]
Outpt Vatues = [0 1]
Relational _|_ Simulink /Math Relational | Greater than or equal to =)
Operator Operations Operator |
‘Constant | Simulink / Sources Constant | Constant Valoe=1 (For Duty Cycle)
@mumbers) _ | Constant Value = 200 (For Torque)
DCMotor | SimpowerSystems7 | _DC Machine | Default
‘Machines
Disereie | Simpower Systems7 | Discrete Mean_| Fundamental Frequency = 30
‘Mean Vatve | _ Extra Library/ Vatve ‘Remaining Parameters Default)eA Wei a wd ea
ks
2. ate mae te
2. ows rn
ae at de Pe pa 2
‘aera nrc te nt ed,
Tt RS a Wg la ae, 8
Tae i fGe e,OUTPUT:
= = ees
Fie. aces
= oa
= . fo
= 2 ET aloutrut:
| nae oer (Oa rt) = 84
| Sane ‘ee eee by pm
‘a cues (cand pret J, ¢
tame some ta ym
Sistien +5 Gomssns ose 43 eHYop) MD
ee dna elie
ert ae Df AE
i ee gm 0
‘te Or fa
ee a acm a it 2
‘ret acti nt 9
eee no sue
a
pit eri ot 1 0
|] ins exci toi 220
‘pein vei 3:30
one ED IS
jes pret csOUTPUT;
ep pe inte 8ouTruT:OUTPUT:OUTPUT:
1, (A) Full Wave Bridge Rectifier with RL Load.OUTPUT:
2, (A) Full Wave Bridge Rectifier with RLE LondOUTPUT:
(A). Chopper Controlled DC Motor