You are on page 1of 37
URN: 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) 2210163 Index Exp. No Name of Experiment Page No. Date of Performance Write a Program for Computation of Real Power, Reactive Power & Line loss. 4 Write a Program To Plot V- Curve and Inverted V-Curve. Write a Program for Transmission Line Parameter Calculation (2, 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. gy Write a Program for Load Flow Solution by Newton — Raphson ‘Method. tp 20 Simulation of the performance of a full wave bridge rectifier with RL and RLE Load. 23-95 ‘Simulation of Chopper controlled DC Motor. 26-2 EXPERIMENT NO-1 Date AIM: Write a Program for Computation of Real Power, Reactive Power & Line loss. REQUIREMENT: 1)P.C, 2) MATLAB PROGRAM: cle clear all gprint€(*\n MEND\n') fprinté('\n 1. Single Phase Power system\n') fprintf(*\n 2. Three Phase Power System\n') choicesinput (‘\n Enter the choice of Power System: '); if (choice==1) Ricinput ("Enter the Total Resistance of the Line(in ohms), RL= Veinput ("Enter RMS Value of Voltage (in Volts), V= '); Ieinput ("Enter RMS Value of Current (in Anperes), I="); pfeinput (‘Enter Power Factor, PF= '); ‘Loss=R1*I*2; Ffesin(acos(pf)); PaV*I*p; Qaverire; fprintf(*\n Active Power: tg W\n',P); fprint£(*\n Reactive Power: #g VAr\n',Q); fprintf('\n Line Loss: $g W\n', loss); end Lf (choice==2) Rsinput ("Enter the Total Resistance of the Line(in ohms), RL= ' Vieinput ("Enter RNS Value of Line Voltage (in Volts), VL= '); Teinput ("Enter RMS Value of Line Current (in Anperes), I= '); pfvinput ("Enter Power Factor, PF= ']; VP=VL/sqrt (3); loss=3*R1*1*2; rfesin(acos(p£)); Pesqrt (3) “VP*I*p£; Q-sqrt (3) *vP*Iére; fprint£('\n Active Power: %g W\n', P)7 fprint£("\n Reactive Power: tg VAr\n',Q); fprint£('\n Line Loss: tg W\n',loss); end EXPERIMENT NO.-2 Date: AIM: Write a Program To Plot V- Curve and Inverted V-Curve. REQUIREMENT: 1)P.C. 2) MATLAB PROBLEM STATEMENT: AS0-MVA, 30-KY, three phase, 60 Hz synchronous generator has a synchronous reactance of 9 @ per phase and a negligible resistance. Construct the V-Curve and the Inverted V- Curve for the rated power of 40 MW with varying field excitation from 0.4 pf leading to 0.4 pflagging. Assume the open circuit characteristic in the operating region is given by: E=20001rV. PROGRAM: fprinté("\n V-CURVE & INVERTED V-CURVE PLOT\n\n') fprint£ (INPUT: \n\n") Pe input ("Enter Real Power (in MW), P= ")i ve input ("Enter RMS Value of Line Voltage Power (in kV), V= "Ji z= input (‘Enter Synchronous Impedance (in ohms), 2 = ')i pf = input (‘Enter Power Factor), PF = '); B= 40; & real power, Mi V = w/sqrt(3)+ 3*0; % phase voltage, kV Zs = 3#2; 4 synchronous impedance ang = acos(pf); thetasang:~0.01 to 0.4 lagging pf PFacos (theta) ; ang; & Angle from 0.4 leading Ps Ptones (1, length (theta) }; 8 generates P array of same size Tam = P./(3*abs(V) *cos (theta) ) 4 current magnitude kA Ia = Tam.*(cos(theta) + j*sin(theta)): 4 current phasor B= V+ 2s.*3a; 4 excitation voltage phasor En = abs (E); ¥ excitation voltage magnitude, kV If = En*1000/2000; % field current, A subplot (2,1,1) plot (If, Iam,'k','linewidth',2.5), grid xlabel('If,A'), ylabel(*Ia, kat) text (3.4, 1, ‘Leading pf'), text (13, 1, ‘Lagging pf*) text (9, .71, 'Upf') subplot (2,1,2) plot (If, PF ,tk', "linewidth", 2.5), grid xlabel(*I£, At), ylabel("p£") axis ((2 18 0 1.51) 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-KV, 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') {printf (*\nINPUT:\n\n") r= input (‘Enter line resistance (in Ohms per unit length), r= ' input ("Enter line inductance (in MilliHenry per unit length), L = © = input ("Enter line capacitance (in MicroFarad per unit length), C = '); g ~ input("Enter line conductance (in Siemens per unit length), g ="); £ = input ("Enter Frequency (in Hz) ="); Length = input (‘Enter Line length (in km) = x + j*2*pit£*L/1000; 2 = z2*Length; ) y = g + }*2*pi*t+c/1000000; Y # y*Length; Ral + 2y/2; Ba C= Ye(1 + 24Y/4); D= Ay fprinté (\n\nOUTPUT: \n\n") fprintf('2=\n f-11,5g + 3', real(z)), fprintf(*t-11.5g', imag(Z)) fprintf(*\nY=\n 4-11.59 + 4", real(y)), fprinte('t-11.59", imag (¥)) ARCD = [A By CD]; diep(* *) fprinté('\nABCD = \n") fprinte(* $-11.5g + 3", real(a)), fprint£(* $-11.5g", imag (A)) fprintf(* %-11.5g + 3%) real(B)), fprinté(’ $-11.59 \n", imagiB)) fprint£(* $12.59 + 5%, real(C)), fprinté(’ t-11.59",.dmag(C)) fprintf(* %-11.5g + j', reai(D)), fprintf(' t-11.5g \n', imagiD)) fprinte(* \n") EXPERIMENT NO.-4 Date: 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: Cy 500+5.3P;+0,004P? y= 400+5.5P,+0,006P;? Cs= 20045.8P;+0.009P;" where P,, P2 and Py are in MW. The Total Load, PD, is 800 MW. Neglecting Line losses and generator limits, find the optimal dispatch and the total cost inRs./ hr. PROGRAM: cle; clear all; fprinté(*\n ECONOMIC LOAD DISPATCH\n') fprinté(*\nINPUT: \n') neinput ("Enter the number of Units:'); alpha=zeros(n); betaszeros(n); ganmanzeros(n); for i=i:n fprint£('\nEnter the Cost Function Data for Unit tg \n',il7 ganma(i)=input (‘Enter the value of gamma= '); beta(i)=input (Enter the value of beta» alpha(i)*input ("Enter the value of alphas '); end pdeinput ('\nEnter the value of Total Load Demand (in Mil)= '); Pazeros(n); sum=07 den=0; for ielin sunssumt (beta (i) /(2*gamma()))7 end for isl:n den=den+(1/(2*ganna(i))); end num=pdtsum; lamdasnum/den? for ielin P(i)=(lamda~beta(i)) /(2*gamma(i)); end fprinté('\nOUTPUT:\n") fprint£("\nbamda: $g ',lamda); for isin fprint£("\nOptimal Generation of unit tg: %g MW',i,P(i)); end fprintf('\n'); for i=1:n unitcost=gamma (i) *P(i)*2+beta (i)*P(i)+alpha (i); fprint£('\nGeneration cost of Unit &g : Rs. tg',i,unitcost); end totalcost=0; fprintf('\n"); for isl:n totalcost=totalcost+gamma(i)*P(i)*2tbeta(i)*P(i)+alpha (i); end fprintf("\nTotal generation cost : Rs. %g \n', totalcost) + EXPERIMENT Nt ‘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): Vi= 240 V; Ip=10A; Po=1440 W Short-Cireuit Test (form L.v. side): Vsc= 187.5 V; Isc=50A; Psc=2625 W Determine the Parameters of the Equivalent Circuit, PROGRAM: cle clear all; sprints ("\n ‘TRANSFORMER PARANETER CALCULATION\n\n') fprint£(* INPUT: at) S = input (' Enter Transformer rated power in kVA, S = '); Elv = input(' Enter rated low voltage in volts = '); Ehv = input (' Enter rated high voltage in volts = '); fprint£("\n Open circuit test data \n\n') fprinté(* - \n') tso = 0; while stromp(tso, 'lv')==1 & strcmp(tso, 'LV')~*1 & stromp(tso, ‘hv')~=1 & stremp(tso, 'HV'}~=1 fprintf(" Enter ''lv'' within quotes for data referred to low side or \n') tso = input(' enter 'thv'' within quotes for data referred to high side -> '); A£ stromp(tso, 'lv')~=1 6 stromp(tso, 'LV')~=1 & stremp(tso, ‘hy')=m1 & stremp(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, Po = Re = (Vo) *2/Po; Ic = Vo/Re; if Io > To fprintf(* Error, Ic > To. Inconsistent test data. Check test data and try again'); return, end Im = sqrt (Io*2 = Ic%2); Xm = Vo/Im; Af tso == "lv! | tso == ‘LV! Relv = Re; Xmlv = Xm; Rehv = (Ehv/Elv)*2*Re; Xmhv = (Ehv/Elv) *2*Xn; else, end if tso == ‘hv’ | tso == ‘HV! Rehv = Re; Xmhv = Xmz Relv = (Elv/Ehv)*2*Rc; Xmlv = (Elv/Ehv)*2*Xn; else, end fprint£('\n Short circuit test data \n') fprinté(' - \n') tsce0; while stremp(tsc, '1v')-=1 & stremp(tsc, 'LV')~=1 & stremp(tsc, 'hy'}-=1 & stremp(tse, "HV" ~=1 fprintf(' Enter ‘tly! within quotes for data referred to low side or \n") tec = input(' enter 'thv'' within quotes for data referred to high side ->' Af stremp(tsc, '1v')-=1 & stremp(tse, "LV" thytjesl & stremp(tsc, ‘HV')~=1 fprintf("\n Incorrect reply, try again \n\n"), ~o1 & strenp(tse, end end Vsc = input(" Enter reduced input voltage in volts, Vsc = '); Isc = input (' Enter input current in Amp, Isc = '}; Psc = input(' Enter input power in Watt, Psc = '); Zenag = Vsc/Isc; Re = Psc/Isc%2; if Re > Zemag fprintf(' Error, Re > Ze. Inconsistent test data. Check test data and try again’); return, end Xe = sqrt (Zemag*2 - Re*2); Ze = Re + j*Xez if tsc == "lv! | tec == ‘Lv! Zelv = Ze; Zehv = (Ehv/Elv)"2*zZe; else, end if tsc = thvt | tec a= 'Hv! Zehv = Ze; Zelv = (Elv/Ehv)*2*Ze; else, end cle fprint£(*OUTPUT: \n') fprint£("\n Shunt branch xef. to LV side ') fprintt(" Shunt branch ref. to HV side \n') fprinté(" Re = 412.3f ohm', Relv), fprinté(' $12.38 ohm \n', Rehv) fprintf£(" Xn = $12.3£ ohm', Xmlv), fprint£(' 412.3£ ohm \n", Xmhv) fprint£("\n Series branch ref, to LV side ') fprintf(* Series branch ref. to HV side \n') fprintf(* Ze = $10.6", real(zelv)), fprintf(" + 3 $10.6£ fprinté(" ze = $10.6£", real(zehv)), fprintf£(' +3 imag (Zehv) ) Xm = ohm’, imag(zelv) ) 410.6£ ohm \n\n", EXPERIMENT 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 S- Bus System whose data is given below: Bus Data: Bus Bus Volvage Angle —~ No code Mag, Degree 1 1 106 0.0 0.0 00 0.0 00 0 oO 0 2 2 1,083 0,0 21.70 32.7 40.0 0.0 40 500 30 10 00 24 12 00 00 9 0 0 40 106 0.0 76 16 00 0.0 0 0 0 S$ 2 1.01 0.0 94.2 19.0 0.0 00 -40 49 0 Line Data: Line code Bus bus RK X 2B = 2 for Lines plo mr ped, = pet, ped, = > Lor <1 te tap at bus nl 1 2 0.0192 0.0575 0.02640 a 1 30,0452 0.2852 0.02040 1 2 4 0.0870 0.2737 0.01840 1 3 4 0.0132 0.0379 0.00420 1 2 5 0,0472 0.2983 0.02090 1 PROGRAM: ele clear fprinté(*\n LOAD FLOW SOLUTION USING GAUSS SIEDAL METHOD\n\n'); basemva = 100; accuracy = 0.001; maxiter = 10; fprinté(*\n BUS DATA\n\n") fprintf('Bus Bus Voltage Angle -Load- ==- Injected\n'); fprint£('No code Mag. Degree Mids Mvar. Ma “Mvar Qmin Qmax Mvar\n\n'); fprintf("l 1 1.06 0.0 0.0 0.0 0.0 00 0 0 2 fprintf('2 2 1,043 0.0 21.70 12.7 40.0 0.0 -80 50. O\n")z gprintf(*3, 0 “1.0 "0,0 2.4 2 0.0 0.0 0 O O\n"): fprinte("s 0 1.06 7.6 1.6 0.0 0.0 0 0 O\n'); fprinte('S 2.01 0.0 94.2 19.0 0.0 0.0 -40 " 40 O\n"); busdata=[1 i 1.06 a0 9.0 0,0 0.0 0.0 0 0 0 22 1043 0:0 21.70 12.7 “40.0 0.0 -40 50 0 30 «61.0 0.0 2.4 2.2 ° 0,0 0.0 0 0 ° 40 (1.06 0.0 7.6 1.6 0.0 0.0 0 0 o 5 2 2,01 0.0 " 94.2 19.0 0.0 0.0 -40 40 ol: fprinté("\n LINEDATA\n\n'); {print £(*\n Line code\n\n'); fprintf("Bus bus x 2B 1 for lines\n'); fprinté(" nl nr p.w peu. peu. > Lor <1 tr. tap at bus nl\n'); fprintf(' 1 2 0.0192 0.0575. 0.02640 A\n'); fprinte(* 1 30,0452 0.1852 0.02040 A\n'); fprintf(* 2 4 0.0870 0.1737 "0.01840 a\n") fprintf(* 3 4 (0.0132 "0.0379 0.00420 ant); fprintt(* 2 5 0.0472 0.1983 0.02090 an); linedata=(1 2 0.0192 0.0575 0.026401 13 0.0452 0.1852 0.02040 “1. 2 4 0.0570 0.1737 0.018401 3 4 0.0132 0.0379 0.00420 «1 2 $ 0.0472 0.1983 0.02090 1); ‘this part obtains the Bus Admittance Matrix for power flow solution jesqrt (-1); 4 = sqrt (-1); ml = linedata(:,1); nr = Linedata(:,2); R= Linedata(:,3) X= linedata(:,4); Be = jelinedata(:,5); a = linedata(:, 6)7 Abrelength(Linedata(:,1)); nbus’= max(max (nl), max(nr)); 2 = R + 4#X; y= ones(nbr,1)./2 ‘branch admittance for n= l:nbr if a(n) <= 0 a(n) = 1; else end Ybus=zeros(nbus,nbus); _$ initialize Ybus to zero. § formation of the off diagonal elements for kelinbr; Yous (nl (ie) nx (Xe) )=¥bus (n} (k) , nz (Kk) )~ ¥.0) /a (00 5 Yous (nz (k) - nb (k) J mYbus (nl (k) p= (k)) 7 en a % formation of __ the diagonal elements for nel:nbus for kel:nbr Sf nl (k)w=n Ybus(n,n) = Ybus(n,n)+y(k)/(a(k)*2) + Belk); elseif nr(k)==n Ybus(nyn) = Ybus(n,n)+y(k) +Bo(k) ¢ else, end end end ‘This part obtains the power flow solution by Gauss Siedal Method Vme0; deltae0; yload=0; deltad =07 nbus = Length (busdata(:,1))7 for kelinbus nebusdata (ky 1 kb(n)sbusdata(k, 2); Vm(n)=busdata(k,3); delta(n)=busdata(k, 4); Pd(n)=busdata(k, 5); Qd(n)=busdata(k, 6); Pg(n)=busdata(k,7); Qgin) = busdata(k, 8)7 Qmin(n)=busdata(k, 9); Qmax(n)sbusdata(k, 10); Qsh(n)=busdata(k, 11)? Af Vm(n) <= 0 Vin) = 1.0; Vin) = 1+ 5107 else delta(n) = pi/18otdelta(n); Vin) = Vi(n)*(cos(delta(n)) + j+sin(delta(n)))7 P(n)=(Pg(n)-Pd(n) ) /basenva; Qin)=(Qgin)-Gdin)+ Qsh(n)) /basemva; S(n) = Pin) + dsoind: end Dvin)=0; end nun = 0; AcurBus = 0; converge = 1, Ve = zeros (nbus,1)+j*zeros(nbus, 1); Sc = zeros(nbus, 1)+j*zeros (nbus, 1); while exist (‘accel') accel = 1.3; end iter=0; 10; while maxerror >= accuracy & iter <= maxiter itermitertl; for n= limbus; YV = 0+5*0; for L = Ainbr; if nl(L) == n, kenr (1) we we Ybus (n, k) *V (1) 7 elseif ar(L) =n, kent (L); w = YV + Ybus(n, k)*V(K)7 end end Se = conj(V(n})*(¥bus(n,n)*Vin) + YW); Se = conj (Sc); DP(n) = Pin) ~ real (Sc); Dein) = Q(n) = imag (se! if kb(n) == 1 S(n) “Scr P(n) = real(Sc); Q(n) = imag(Sc DPin) =0; DQin)=0; Ve(n) = Vind: elseif kb(n) == 2 Q(n) = imag(se); S(n) = Pin) + 5*Qin)s if Qmax(n) == 0 Qge = Qin) *basemva + Qdin) - Qshin); Af abs(DQ(n)) <= .005 & iter >= 10 4 After 10 iterations if DV(n) <= 0.045 4 the Mvar of generator buses are Lf Qge < Qninin), 4 tested, If not within limits vmin) Vin)» Vain) + 0.005; § As changed in steps of 0.005 pu DV(n) = DV(n) +.005; Sup to .05 pu in order to bring elseif Qge > Qmax(n), § the generator Mvar within the Vm(n) = Vm(n) - 0,005; % specified linits. DV(n)=DV(n)+. 005; end else, end else,end else, end end Af kb(n) ~= 1 Ve(n) = (conj(S(n))/conj (V(n)) - YV )/ Ybus (n,n); else, end if kb(n) = 0 Vin) = V(n) + accel*(Ve(n)- elseif kb(n) == 2 Ve = imag(ve(n)); VoR = sqrt (Vmin)*2 ~ Vor*2); Ve(n) = VoR + 3*VeIs Vin) = vin) + accel*(Ve(n) -V(n)); end end maxerroremax( max(abs(real(DP))), max(abs(imag(DQ))) + ig iter == maxiter & maxerror > accuracy fprint£('\nWARNING: Iterative solution did not converged after ') fprint£("'g', iter), fprintf(' iterations. \n\n") fprintf ("Press Enter to terminate the iterations and print the vin) results \n') converge = 0; pause, else, end end cle Af converge -=1 tech= (* Power Flow Solution by Gauss-Seidel Method"); else, tech=(* Power Flow Solution by Gauss-Seidel Method") end Vm(n) = abs (V(n)); deltad(n) = angle(V(n))*180/pi; if kb(n) == 21 S(n)=P(n)+3*Q(n) 7 Pg(n) = P(n)*basenva + Pdin); Qgin) = Q{n)*basenva + Qd(n) - Qshin) ; kektL; Pgg(k) =Pg(n) 7 elseif kb(n) ==2 kektly gg (k)=Pg(n) 3 S(n)=P(n)+3*Q(n) Qg(n) = Q(n)*basemva + Qdin) - Qshin) 7 end yload(n) = (Pd(n)- J*Od(n)4j*Qsh (n)) /(basemva*Vm(n)*2); end Pgt = 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 YV converge delta Evy ‘his part prints the power flow solution on the screen disp(tech) fprinté("\n Maximum Power Mismatch = tg \n', maxerror) fprintf(* No, of Iterations fg \n\n', iter) head =(' Bus Voltage Angle Load: ==-Generation Injected! v "No. Mag. Degree var Mi Mvar Mvar "]7 disp(head) for nel:nbus {printf (" 5g", n), fprinté(” $7.36", Vain), fprinte(" 48.36", deltadin)), fprint£(* $9.3£", Pdin)), fprint£(’ 19.36", Qd(n)), fprinter* $9.3£", Pgin)}, fprintf(* $9.3€ ', Qgin)), fprint£(* ¥8.3f\n', Qohin}) end fprinté(" \n'), fprinte(" Total ” fprintf(* 49.36", Pdt), fprint£(' $9.3£", Qdt), — fprinté(* 49.38", Pot), fprinté(* $9.36", Qt), fprint£(* 89.3£\n\n", asht) fprint£(*\n\n Hit return to continue \n‘) pause ‘This part computes the line flow and losses cle SLT = 0; fprinte("\n') fprinté(* Line Flow and Losses \n\n') 2 fprintf(' _--Line-- Power at bus & line flow Line loss-~ Transformer\n') fprint£(" fron to Mit Mar MVA Mvar tap\n") for n= 1inbus busprt = 0; for L = linbr; if busprt ==0 fprintf(‘ \n'), fprintf£('s6g', n), fprinte(” 49.3£", P(n) *basemva) fprint£('89.3£", Qin) *basenva), fprint£(*89.3£\n', abs(S(n)*basemva)) busprt = else, end if nl(L)==n k= ne(L); In = (V(n) ~ a(L)*V(k)) *y(L) /a(L)*2 + Be(L) /a(L)*2*V(n) Tk = (V(x) ~ Vin) /a(L)) *y(L) + Bo(L)*¥(K); Snk = V(n)*conj (In) *basemva; Skn = V(k) *conj (Ik) *basenva; SL = snk + Ska; SLT = SLT + SL: elseif ‘nr(L)=en k = nl(L); In = (Vin) ~ V(k)/a(L))*y(L) + Be(L)*Vin) Tk = (V(k) = a(L)*V(n))*y(L) /a(L)*2 + Bo(L) /a(L)*2*V(k); Snk = V(n)*conj (In) *basemva; Skn = V(k) *conj (Tk] *basenva; SL = Snk + Sknz SLT = SLT + SL; else, end if nl(L)==n | nr(L)=en fprint£("%12g", k), fprint£('t9.3£", real(Snk)), fprint£('89.3£", imag(snk)) fprinté('49.3£', abs(Snk)), fprintt('t9.3£", real(SL)}, if nl (L) wen a(L) ~= 1 fprinté("89.3£", imag(SL)), fprint£(*49.3£\n', a(L)) else, fprintf£('89.3f\n", imag(SL)) end else, end end end SLT = SLT/2; fprintf(' \n'), fprintf£(’ Total loss. *) fprinté("89.3£%, real (SLt)), fprint£('%9.3£\n", Amag(SLT)) clear Tk In SL SLT Skn Snk 3B EXPERIMENT 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 Solution by the Newton Raphson Method for a 5- Bus System whose data is given below: Bus Data: Bus Bus Voltage Angle -—-~--Load-—-- No cote Mag, Degree MH Mvar 1 1 106 0.0 0.0 0.0 00 00 0 0 0 2 2 1,04 0.0 21.70 12.7 40.0 0.0 ~40 $0 0 $0 10 00 24 42.2 00 0.0 0 0 0 40 106 00 76 1.6 00 00 0 oO 0 S 2 1.01 0.0 94.2 19.0 0.0 0.0 40 40 0 Line Data: Line code Bus bus X 2B = 1 for Lines alo nr pw. Pou. pus = > Dor d or <1 tr. tap at bus nl\n'); fprintf(* 1 2 0.0192 0.0575 0.02640 A\n'); fprinte(" 1 3 0.0452 0.1852 0.02040 A\n'); fprintf(* 2 4 0.0570 0.1737 "0.01840 ain"): fprinte(? 3 4 0.0132 "0.0379 0.00420 ant); fprinté(" 2 5 0.0472 0.1983 0.02080 a\n"); Linedatas(1| 2 0.0192. 0,0575 0.026401 8 8 0.0452 0.1852 0.02040 “1 2 4° 0.0570" 0.1737 0.018401 3 4 0.0132 0.0379 0.00420 1 2 S$ 0.0472 0.1983 0.02090 117 ‘This part obtains the Bus Admittance Matrix for power flow solution Sesqrt (-1); 4 = sart(-1) nl = linedata(:,1); nr = linedata(:,2)7 R= Linedata(:,3); X = linedata(:,4); Be = jelinedatal:,5): a = linedatal:, 6): Abr=length (linedata(:,1)); nbus’= max (max (nl), max(nr)); Z = R + 3*X; y= ones(nbr,1)./Z; branch admittance for n= l:nbr if a(n) <= 0 a(n) = 1; else end Ybusszeros(nbus,nbus); _& initialize Ybus to zero 8 formation of the off diagonal elements for kel:nbr; Ybus (Al (k) , nx (k) )=¥bus (2 (k) pn (k))~ y(k) /a(K) Yous (nr (Xk) -n (k) )=¥bus (n2 (1k) ,nx (1) end 15 a % formation of the diagonal elements for ‘nelinbus: for kelinbr Sf nl (k)==n Ybus (n,n) = Ybus (n,n) +y(k) /(a(k)*2) + Be(k): elseif nr(k)==n Yous (n,n) = Ybus(nyn)+y(k) #Be (Kk): else, end end end ‘Tis part obtains the power flow solution by Newton Raphson Method nee0; ng=0; Vne0; delta deltad=0; nbus = Length (busdata(:,1)); for ke1:nbus nebusdata (k, 1) 7 kb (n)=busdata (k, 2); Vm(n)=busdata(k,3); delta(n)=busdata(k, 4)7 Pd (n)=busdata(k, 5); Od(n)=busdata(k, 6); Pg(n)-busdata(k,7)7 Qg(n) = busdata(k,8); Qmin(n)=busdata(k, 9); Qmax(n)=busdata(k, 10); Qsh(n)=busdata(k, 21); if Vain) <= 0. Vinin) = 1.0; Vin) = 1 + 3*0; else delta(n) = pi/i80*delta(n): Vin) = Vinin)* (cos (delta(n)) + j#sin(delta(n))) P(n)=(Pg(n)-Pd(n) ) /basenva; Q(n)=(Qg(n)-Qd(n} + Qsh(n)) /basenva; S(n) = Pin) + Join); end end for kel:nbus if kb(k) == 1, ns = ns#1; else, end if kb(k) = 2 ng = ngti; else, end ngs (k) = ng: nss(k) = nsz end Yneabs (Yous); t = angle(Ybus);_m=2*nbus- ng-2*ns; maxerror = 1, converges1; iter = 0; % Start of iterations clear A DC J Dx while maxerror >= accuracy & iter <« maxiter § Test for max. Power mismatch for i=1:m for kel: AL, k)=07 sInitializing Jacobian matrix end, end iter = Ster#1; for nel:nbus yload=0; nnen-nss(n);_Imenbus¢n- ngs (n)~nss(n)-ns;_J11=07 322-0; J33=0; J4an0; for i=1:nb: df nl(i) =n | ar(i) «=n Af nl (i) = n, 1 = nr(i); end if nr(i) == n, 1 = nl(i); end J11-I11+ Vin(n) *Vm(1)+¥m(n, 1) *sin(t (n,1)- delta(n) + delta(1)); J339933+ Vm (n) *Vim(1) *¥m(n, 1) *cos(t (n/1)- delta(n) + delta(1)); Af kb(n)~=1 922922+ Vm(1) *¥m(n,1)*cos(t (n,1)- delta(n) + detta(1)); Rr EN irs Vm(1)*¥m(n,1)*sin(t(n,1)~ delta(n) + delta(1)); else, end Af kb(n) -= 10 & kb(1) ==1 1k = nbus+l-ngs(1)-nss(1)-ns; lel- nss(1): 16 4 off diagonalelements of J1 A(nn, 11) =-Vm(n) *¥m(1) *¥m(n, 2) #sin(t (n,1)- delta(n) + delta(1)); Af kb(1) “= 0% off diagonal elements of J2 A(nn, 1k) =Vm(n) *¥m(n,1)*cos(t (n,1)~ delta(n) + delta(1)) send Af kb(n) == 0 & off diagonal elements of J3 A(Am, 11) =-Vinin) *Vm(1) *¥m(n, 1) *cos (t (ny 1)- delta(n)+delta(1)); end if kbin) == 0 @ kb(1) == 0 & off diagonal elements of 34 AQm, 1k) == Vin(n) *¥m(ny1)*sin(t(n,1)= delta(n) + delta(1));end else end else , end "ond Pk = Vin(n) *2*¥m(nyn) *cos (t (ny) ) #5337 Qk = Vin) *2*¥m(n,n) *sin(t (myn) )~ gy if kb(n) == 1 P(n)=Pk; Q(n) = Qk; end 8 Swing bus P Af kb(n) == 2 Qin) "Ok; if Qnax(n) ~= 0 Qge = Q(n)*basemva + Qd(n) - Qshin); if iter <7 % Between the 2th & 6th iterations if iter > 2 % the Mvar of generator buses are if Qge < Qninin), & tested. If not within limits Vmin) Vmin) = Vmin) + 0.01; 4 is changed in steps of 0.01 pu to elseif Qgc > Qnax(n), % bring the generator Mvar within Vm(n) = Vin) = 0.01;end 4 the specified limits. else, end else,end else, end end if kb(n) ~= 1 ‘A(nn,nn) = Jil; $diagonal elements of Jl Dein) = P(n)-Pk; end if kbin) == 0 A(nn,1m) = 2*Vm(n)*¥m(n,n) *cos(t(n-n))+J22; tdiagonal elements of J2 A(Im,nn)= 93 ‘diagonal elements of J3 A(1m,1m) =-2*Vm(n)*¥minyn)*sin(t(n,n))-J44; diagonal of elements of J4 DC(1m) = Q(n)-Ok; end end DX*A\DC'; for nn=n-nss(n) 7 Lmenbus+n-ngs (n)=nss (n)-ns; Lf kb(n) ~- 1 delta(n) = delta(n)+DX(nn); end if kb(n) == 0 Vmn(n)=Vm(n)+DX (1m); end ‘end maxerroremax (abs (DC) ); if iter == maxiter & maxerror > accuracy £print£('\nWARNING: Iterative solution did not converged after ') fprint£("tg', 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 7 tech= (* ITERATIVE SOLUTION DID NoT CONVERGE"); else, tech=(* Power Flow Solution by Newecn-Raphson Method’); ond ve Vn *cos (dota) +3*Vn. *ain (det ay deitad=160/pi*deita; fmaget (11; ke0; for n= nus, | Sf k(n) == 2 ieee Sim= Pini +3¢Qin)s Pg{n) = P(n)*basenva + Pdin); Qgin) = Qin) *basenva + Qd(n) - shin; P9g (kl =Pg (n) + 059(%)=09(n) 7 ‘june 97 elseif kb(a) a2 0“ kek#l; S(n)=P(n)+3*Q(n) 7 Qgin) = Qin)*basomva + Qd{n) - Qshin); Pag (kl=Pg (nd Qgg(k)=g in)?’ & June 1997 end yloadin) = (Pdin)- J*Qd(n) +3 +Qsh{(n) )/ (basenva*Vm(n)~2);_ end busdata(:,3)=Va'; busdata(+,4)=deltad" Pgt = sum(?g); Qgt = sum(Qg); Pdt = sum(Pd); Qdt = sum(Qd); Qsht = sun(Qsh); Sclear A DC DK J11 422 J33 J44 Qk delta 1k 11 Im Qclear A DC DX J11 322 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 = ‘g \n\n', iter) head =(' Bus Voltage Angle Load==--~~ Injected’ "No. Mag, Degree MW Mvar cl Mar Mar? , "]i disp(head) for nei:nbus fprintf(* 05g", n), fprint£(* 07.3£", vm(n)), fprineé(" 0.3", deltadin)), fprintf(* 09.3£", Pdin)), fprint£(" 49.3£", Qd(n)), fprinte(* 89.3£", Pgin)), fprintf(* $9.3£ ', Qgin)), fprintf£(* ¥8.3£\n", Qsnin)) end fprintt(* \n'), fprintf(* Total ) fprintf(' 49.36", Pat), fprinté(' 49.3£", Qdt), fprint£(* 49.36", Pgt), fprints(* $9.36", Qgt), fprinté(' 49.3£\n\n", Qsht) fprint£(*\n\n Hit return to continue \nt) pause THis part computes the line flow and losses cle SLT = 0; fprint£(*\n') fprintt(' Line Flow and Losses \n\n") fprint£(* =-Line-- Power at bus & line flow — --Line loss-~ Transformer\n') fprint£(* from to MW Mvar | MVA Mvar tap\n") 18 for n = linbus busprt = 07 for L = linbr; AE busprt == 0 fprint£(" \n'), fprinté('t6g", n), fprinte(* t9.36", P(n) *basemva) fprint£("49.3£", Q(n)*basemva), fprint£("89.3£\n', abs (S(n) *basenva) ) busprt = 1; else, end Lf al(L)==n kom nr(L); In = (Vin) ~ a(L)*V(k)) *y(L) /a(L)*2 + Be(L) /a(L) *2*V(n) + Tk = (V(k) = V(n) /a(L)) *y(L) + Be(L)*V(K)s Snk = V(n)*conj (In) *basemva; ‘Skn = V(x) *conj (Ik) *basenva; SL = Snk + SLT = Sut elseif nr(L)==n k= nl(L); In = (V(n) = V(k) /a(L)) *y(L) + Be(L)*Vin) Tk = (VCR) = a(L)*V inj )*y(L) /a(L)*2 + Be (L) /a(L)*24V (i) + ‘Snk = V(n)*conj (In) *basemva; 'Skn = V(k) *conj (Ik) *basemva; SL = Snk + Skn; SUT = SLT + SL; else, end Af nl (Leen | nr (L fprint£('t12g", k), fprinté('89.3£", real(Snk)), fprint£('89.3£", imag(Snk)) fprint£('89.3f, abs(snk)), fprint£(*89.3f", real(SL)), Af ml(L) wen & a(L) == 1 fprinte(*t9.3f", imag(SL)), fprintf£(*89.3f\n', a(L)) else, fprintf('$9.3£\n', imag(SL)) ond else, end end end SLT = SLT/2; fprintf(* \n"), fprintf(* Total loss *) fprinte("$9.3£", real(SuT)), fprint£('89.3£\n", imag(SLT)) clear tk In SL SLT Skn Snk 19 EXPERIMENT NO-- Date: All mulation of the performance of a full wave bridge rectifier with RL and RLE Load. REQUIREMENT: 1)P.C. 2) MATLAB-SIMULINK PROCEDURE: A. Eull Wave Bridge Rectifier with RL Load 10 Steps to create model by using Simulink: 1, Click on File then New then Model. 2. On resulting window click on yLibrary 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 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 of the 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 etc. 6. 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- »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 RL 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. 1 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"; it is essential when circuit contains power system or power electronics tools. And the stop time value should be 5/50 for SOHz supply 20 frequency for five cycles. For ,n"* number of cycles, stop time would be n*(1/S0) for ‘SOHz supply, where n=1, 2, 3.... and also set Max Step Size to le-5 and Min Step Size to le-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 ‘Kepextng | Tune Values = —seauence_| Quer Vator Time’ = TO. x Sequence | Output Values = [005 0] Rataconal ‘Gan or equal =) Consent | Constant ValaesT . 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 etc. . 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, 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. 2 0 si uli ‘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 S0Hz supply frequency for five cycles. For ,n" 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 1e-5 and Min Step Size to 106. To run the simulation, sclect , 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 Measurement" blocks gives voltage and current waveforms respectively with respect to time. 22 Table 2 | — Slain Somees—| Repeating —] Sequence [Componcats | Test Wax7 Bee Pa brary browser HE Vateage | Simpones Syatems 7] AC valine | Peak Ammpites 250 an "Bleccal vourees ‘source’ Phase(oeD =O FrequencyGt2) “50 ma | Sips Sytem Tayo FRET | Power wiecrontes G@ommbers) | Defaate | _Repesting | —Sieaullak 7 Sommeee Repeating | Tae Vator = [0 001 GOT O03] Surge Vales = [0 5 0: Output Vanes [00507 oe a Spatoe Spain Spor easier | —eoasaat | — Stan Somees —| — “Canasta VSIA FOE CSET masse | Yona SeEER vane = 200, Foaae ad FET fae sym Hisnonic: entyeneoeseats | oar sonar Syne || — SSIS RIC Rao ORRT=T = Brock | Inaernncetty eos Sipactenacea tae DeNse | Siapars Syaeas7 | De wEciEs | Besa Rae Ts SapeRe Saas] | BEG Naa ET TSF Mou Vaive | hwntncny? Uae | Geomnining Panccten Detain 23 EXPERIMENT NO.-9 AIM: 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. |. 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. 5. To measure/observe the voltage across or current passes through the electrical lock/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”. = + Steps to simulating the 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", itis essential when circuit contains power system or power electronics tools. And the stop time value should be 5/50 for SOHz supply frequency for five cycles. For ,n" number of cycles, stop time would be n*(1/50) for SOHz supply, where n=l, 2, 3.... and also set Max Step Size to auto and Min Step Size to auto. 3. Torun the simulation, select , Simulation” then select ,Start". 4. If any errors are reported here. Correct schematic or the simulation settings and re-run simulation. 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, 24 Table 1 ‘Components Toot Box7 Block parameters Ubrary browser DCVeltage | Simpower Systems? | DC voltage | Amplitude(v) =360 Source ‘Electrical sources source GTO ‘Simpower Systems 7 GTO Power Electronics Gmmber) | Default | “Repeating | — Simulink Sources Repeating ——T sequenced) Sequence | ForS000Hiz (ie. t= = 20-4) Time Values = [0 2e-4] Ourput Vatues = (0 1] ‘Relational ‘Simulink Math Relational | Greater than or equal to =) ‘Operator ‘Operations ‘Operator ‘Constant | ~ Simalink “Sources Constant | Constant Value=i (For Duty Cycley (2:mmbers) _ | Constant Vatue = 200 (For Torque) ‘DE Motor |“ Simpower Systems7 | DC Machine | Default ‘Machines ‘Discrete | Simpower Systems/ | Discrete Mean | Fundamental Frequency = 50 Mean Vatue | Extra Library / ‘Vatue ‘Remaining Parameters Default) 25 OUTPUT: 1. sage an fe en ee ecto Poe ye 1 ‘aera a ate an 0) erm no la i eo 8 fers eof rat er lanl sapsapeee Bag eager aes eee [Orem nase eds ole ‘oer Hae esses (Os ew Hoa, 28 ae eet a lay ew ea, Ihe se pte (4 Me perwitLo * ae ne ert Ses pat La, awe eee i fae Mb or = 1 ce sae |» Pe sea | exams en. mesure 39. tn ur aie son. 1 OUTPUT: ‘ere eo 8 Dee ewe ae 8 Ie eae ae || Becernim cher re te 30 Ie ef ta dE (int cn a 1 Tl etn ce. ts ee OUTPUT: OUTPUT: OUTPUT: 1, (A) Full Wave Bridge Rectifier with RL Load ee Be ee ae bas bo be HO-wloolo-=— Samm ourruT: 2, (A) Full Wave Bridge Rectifier with RLE Lond 2. (B) Model Graph for RLE Load in continuous mode ourPuT: (A). Chopper Controlled DC Motor De 1A te by om fa pare ie co

You might also like