2 mu_not=4D-7*%pi
3 N=800 //n o . of tu rn s for e a c h sole noid 4 l=90D-2 // len gth of e ac h solenoid
5 Ax=%pi*(3D-2)^2/4 // cro ss − sectio nal ar e a of sol eno id X
6 Ay=%pi*(6D-2)^2/4 // cro ss − sectio nal ar e a of sol eno id Y
7 M=N*N*mu_not*Ax/l
8 mprintf (”Mu tu al indu ctance of arrange ment =%f mH \n ” ,1000*M)
9 // calculat ing cou plin g co − e f f i c i e n t 10 Lx=N*mu_not*N*Ax/l
11 Ly=N*mu_not*N*Ay/l 12 k=M/ sqrt(Lx*Ly)
13 mprintf (”Couplin g co − e f f i c i e n t =%f” ,k )
Scilab code Exa 5.11 Example on Induced EMF 1
2 mu_not=4D-7*%pi
3 Nb=500 //n o . of tu rn s in coil B
4 l=120D-2 //m ean le ng th of flux pa th in iro n circu it 5 Na=50 //n o . of tu rn s in coil A
6 mu_r=2000 // relati ve per mea bil ity of iro n 7 A=80*10^-4 // cro ss − sectional ar ea
8 M=Nb*mu_not*mu_r*Na*A/(l)
9 mprintf (”Mut ua l ind uct anc e M=%f H \n ”,M )
10 di=12 11 dt=.015 12 e=-M*di/dt
13 mprintf (”E mf induc ed in co i l B=%f V ” ,e )
Scilab code Exa 5.12 Example on Growth and Decay of Current in In-ductive Circuits
1
2 V=110 // applied voltage 3 L=.5 // ind uc tan ce of coi l 4 r=V/L
5 mprintf (”Ra te of cha nge of curren t=%d A/s \ n”,r ) 6 R =8// resist ance of coil
7 I=V/R
8 mprintf (” Final steady curren t=%f A \ n ”,I ) 9 T=L/R
10 mprintf (”T ime cons tant= %f sec \ n ”,T ) 11 // so lvi ng part ( iv )
12 t = -log(.5)*T
13 mprintf (” Time ta k e n for t he cu rr ent t o rise t o half it s fin al val ue =%f sec ” ,t )
Scilab code Exa 5.13 Example on Growth and Decay of Current in In-ductive Circuits
1
2 // calcu lating t i m e it will t a k e cu rr en t t o re ac h .8 of its final s t e ad y v al u e
3 L =5// inductan ce of wi nd ing 4 R=50 // resist ance of wi nd in g 5 T=L/R
6 V=110 // applied voltage
7 I=V/R // fin al st ea dy cur ren t 8 i=.8*I
9 t=-T* log(1-i/I)
10 mprintf (”C ur r e nt gr o w s to .8 ti me s its fina l st ea dy v a lu e , %f se c after th e sw it ch is clos ed \ n ”,t ) 11 // calcu lating t i m e it will t a k e for t h e cu rr en t t o
r e a c h .9 of its final s t e a d y v a l u e 12 i=.9*I
13 t=-T* log(1-i/I)
14 mprintf (”T ime ta ke n for th e cur rent to grow to .9 t i m e its final s t e a d y v a lu e is %f sec \ n ”,t ) 15 // calc ulat ing ave rag e emf in du ce d
16 e=-L*(-2.2/.05)
17 mprintf (”emf ind uced= %d V \n ”,round (e))
Scilab code Exa 5.14 Example on Growth and Decay of Current in In-ductive Circuits
1
2 // calculating in du ct an ce and resistance of t he rela y 3 T=.004 //ti me con st ant whi ch is t im e ta ke n for th e
cu rr en t t o rise t o .6 3 2 of its final s t e a d y v a l u e 4 I=.35/.632 // fin al st ea dy va lu e
5 V=200 // applied voltage 6 R=V/I
7 L=T*R
8 mprintf (” Resistan ce of relay ci rc ui t=%f o hm \ nI nd uc ta nc e of relay cir cui t=%f H \n ”,R,L) 9 // calculat ing i n i t i a l rate of ris e of cur rent 10 r=V/L
11 mprintf (” I n i t i a l rate of ri se of current =%f A/s ” ,r )
Scilab code Exa 5.15 Example on Growth and Decay of Current in In-ductive Circuits
1
2 R=.5+40+15 // total resistance 3 L =1// tota l indu cta nce 4 T=L/R
5 V=12 //e mf of batte ry
6 I=V/R // final st ea dy cu rr en t in t h e circuit
7 i=.04 // cu rr en t a t t i m e t after clos ing t h e circuit 8 t=-T* log(1-i/I)
9 mprintf (” The rela y will be gi n t o op er at e %f se c aft er t h e re la y circuit is cl os ed \ n ”,t )
Scilab code Exa 5.16 Example on Energy Stored in Magnetic Field 1
2 mu_not=4*%pi*1D-7
3 // calc ulat ing indu cta nce 4 N=4000 //n umber of turns
5 I =2// cur ren t flow ing in th e solenoid 6 d=8D-2 // dia met er of solenoid
7 As=%pi/4*d^2
8 l=80D-2 // len gth of solenoid in m tr s 9 phi=mu_not*N*I*As/l
10 L=N*phi/I
11 mprintf (”Inductance=%f H \ n ”,L )
12 // calc ulat ing en er gy stored in th e ma gn et ic f i e l d 13 E=L*I^2/2
14 mprintf (”Ene rg y stor ed in the magn etic f i e l d= %f J” ,E )
Scilab code Exa 5.17 Example on Energy Stored in Magnetic Field
1
Scilab code Exa 5.18 Example on Energy Stored in Magnetic Field 1
2 mu_not=4D-7*%pi
3 // calculat ing pull on th e ar ma t ur e 4 mu_r=300 // rel per me abi lit y of iro n 5 AT=2000 // tot al am pe re turns
6 li=50D-2 // lengt h of iron pat h 7 lg=1.5D-3 // len gth of air gap 8 B=AT/(li/(mu_not*mu_r)+.796*lg*10^6) 9 A=3D-4 // are a of ea ch pole sh oe
10 x=B^2*A/(2*mu_not) // pull on th e ar ma tu re at ea ch pole
11 p=2*x
12 mprintf (”Tot al pull due to bo th th e poles =%f N \ n”,p ) 13 // considering th e gap closes to .2 m m
14 lg=.2*1D-3
15 B=AT/(li/(mu_not*mu_r)+.796*lg*10^6) 16 x=B^2*A/(2*mu_not)
17 p=2*x
18 mprintf (”When the gap closes to .2 m m, total force ne ed e d due to b o t h th e po le s , to pull th e arm atu re away=%f N” ,p )
19 //an sw er va ry fro m th e te xtb ook due to rou nd of f error
Chapter 6
Fundamentals of Alternating Current
Scilab code Exa 6.1 Example on AC Wave Shapes 1
2 // plotting gr a ph for i1 3 theta= linspace (0,2*%pi ,100)
4 i1=50* sin(theta)+50* sin(theta-%pi/4) 5 plot (theta,i1)
6 // plotting gr a ph for i2 7 theta= linspace (0,2*%pi ,100)
8 i2=50* cos(theta)+50* cos(theta+%pi/4) 9 plot (theta,i2, ” o ”)
10 // plotting gr a ph for i3
11 i3=50* cos(theta)-20* sin(theta) 12 plot (theta,i3, ”−∗”)
13 xtitle (”Gr ap hs of i1 ( −) , i2 ( oo) an d i3 ( −∗) ”,” th et a ”,” cur ren t ”)
14 / /r o un d off error wh il e plotting gr ap hs
Figure 6.1: Example on AC Wave Shapes
Scilab code Exa 6.2 Example on AC Wave Shapes 1
2
3 // i=Imax ∗ si n ( 2 ∗ %p i ∗ f ∗ t ) 4 Imax=100 //max val ue of curren t 5 f=25 // frequenc y in Hz
6 // calculat ing ti me after whi ch curr ent beco mes 20 A 7 i=20
8 t =asin(i/Imax)/(2*%pi*f)
9 mprintf (”T ime af te r wh ic h curren t be co me s 20 A =%f s e c \n ”,t )
10 // calculat ing ti me after whi ch curr ent beco mes 50 A 11 i=50
12 t =asin(i/Imax)/(2*%pi*f)
13 mprintf (”T ime af te r wh ic h curren t be co me s 50 A =%f s e c \n ”,t )
14 // calc ulat ing ti me aft er whic h current becom es 100 A 15 i=100
16 t =asin(i/Imax)/(2*%pi*f)
17 mprintf (”T ime af te r wh ic h curren t be co me s 10 0 A=%f s e c \n ”,t )
Scilab code Exa 6.3 Example on AC Wave Shapes 1
2 // calculating in sta nta ne ous vol tag e a t .0 05 se c after t he w ave pas se s t h r ou gh ze ro in positive direction
3 f=50 // frequ ency
4 Emax=350 //max val ue of voltage 5 t=.005
6 e1=Emax* sin(2*%pi*f*t)
7 mprintf (”Vo lt ag e at .0 05 se c after th e wave pas ses th ro ug h zer o in positi ve direction= %d V \ n”,e1) 8 // calculating in sta nta ne ous vol tag e a t .0 08 se c
after th e wave pass es th ro ug h zer o in nega tive direction
9 t=.008
10 e2=-Emax* sin(2*%pi*f*t)
11 mprintf (”Vo lt ag e at .0 08 se c after th e wave pas ses th ro ug h zero in negative dire ctio n=%f V” ,e2)
Scilab code Exa 6.4 Example on AC Wave Shapes 1
2 //e=100 ∗ si n ( 100 ∗ %p i ∗ t )
3 // calculat ing rate of c h an ge of volt age at t = . 0 0 2 5 s e c
4 t=.0025
5 r1=10000*%pi* cos(100*%pi*t)
6 mprintf (”R ate of c ha ng e of volt age at .00 25 sec =%f V / se c \ n”,r1)
7 // calculat ing rate of c h an ge of volt age at t =. 0 05 s e c
8 t=.005
9 r2=10000*%pi* cos(100*%pi*t)
10 mprintf (”R ate of ch an ge of voltage at .005 sec =%d V/
s e c \n ”,r2)
11 // calculating rat e of c h a n g e of vol tag e at t =.0 1 se c 12 t=.01
13 r3=10000*%pi* cos(100*%pi*t)
14 mprintf (”R ate of ch an ge of voltage at .01 sec =%f V/
s e c \n ”,r3)
15 // error in tex tb ook an sw er in f i r s t and las t case
Scilab code Exa 6.5 Example on AC Wave Shapes 1
2
3 // calculating greate st rat e of c h a n g e of cur re nt 4 // i =50 ∗ sin (100 ∗ %p i ∗ t )
5 mprintf (” Greates t rate of ch an ge of current =%f A / sec
\ n ” ,5 0*100*%pi )
6 // calculat ing av er age val ue of curr ent 7 f=50 // frequenc y of the wave
8 T=1/f
9 Imean=1/.01* integrate (” 50 ∗ si n (100 ∗ %p i ∗ t ) ”,” t ”,0,T/2) 10 mprintf (”Av er ag e valu e of th e giv en current =%f A \n ”,
Imean)
11 Irms= sqrt(integrate (”(50 ∗ s in ( the ta ) ) ˆ2” ,” th et a ”,0,2*
%pi)/(2*%pi))
12 mprintf (”RMS value of cur ren t=%f A \ n ”,Irms) 13 // cal cul at in g ti me in te rva l be tw ee n a m aximum value
and ne xt zero val ue 14 t=(%pi/2)/(100*%pi)
15 mprintf (”T ime in te rv al be tw ee n a maximum value an d t he ne x t ze ro va lu e is %f se c t o %f se c ” ,t,2*t) 16 / / va lu e of greate st rat e of c h a n g e of cu rr ent is
give n wrong in th e tex tb ook due to ap pro xi mat io n
Scilab code Exa 6.6 Example on AC Wave Shapes 1
2 i =linspace (0,0,2) 3 t =linspace (0,1,2)
Figure 6.2: Example on AC Wave Shapes
4 plot2d (t,i)
42 t =linspace (j+9,j+9,2)
Figure 6.3: Example on AC Wave Shapes
74 Iavg= integrate ( ’ 100 / %pi ∗ si n ( th et a ) ’ , ’ the ta ’ ,0,%pi) 75 mprintf (”Av er ag e value of sine wave=%f A \n ”,Iavg) 76 Irms= sqrt(integrate ( ’ (10 0 ∗ s i n ( th et a ) ) ˆ2/ %p i ’ , ’ the ta ’
,0,%pi))
77 mprintf (”RMS val ue of si ne wa ve=%f A ” ,Irms)
Scilab code Exa 6.7 Example on AC Wave Shapes 1
2 theta= linspace (0,2*%pi ,100)
3 i=10+10* sin(theta) // expre ssion for th e resultant
wave
4 plot2d (theta,i)
5 xtitle (”Wave sha pe fo r ex am pl e 6.7 ” ,” th et a ”,” cur ren t
”) 6
7 // calculat ing av er age val ue of th e resultant wave 8 Iavg= integrate ( ’ 10+1 0∗ si n ( th et a ) ’ , ’ the ta ’ ,0,2*%pi)
/(2*%pi)
9 mprintf (”A v e rag e val ue of th e resultant cur ren t wave
=%d A\ n ”,Iavg)
10 // calculat ing RMS val ue of cur ren t of th e resultant wave
11 Irms= sqrt(integrate ( ’ (10 +10 ∗ si n ( th et a ) ) ˆ2 ’ , ’ the ta ’ ,0,2*%pi)/(2*%pi))
12 mprintf (”RMS value of the res ult ant current wave=%f A”,Irms)
Scilab code Exa 6.8 Example on AC Wave Shapes 1
2 theta= linspace (0,2*%pi ,100) 3 i=50* sin(theta)
4 xset ( ’ wind ow ’ ,0) 5 plot2d (theta,i)
6 xtitle (”Curre nt wave sha pe fo r ex am pl e 6.8 −−>(a)” ,” the ta ”,” cu rr en t ”)
7
8 xset ( ’ wind ow ’ ,1)
9 theta= linspace (0, %pi ,100) 10 i=50* sin(theta)
11 plot2d (theta,i)
12 theta= linspace (%pi ,2*%pi ,100) 13 i=-50* sin(theta)
14 plot2d (theta,i)
15 xtitle (”Curre nt wave sha pe fo r ex am pl e 6.8 −−>(b)” ,”
the ta ”,” cu rr en t ”)
51 mprintf (”F or wa ve sh ap e (a) \ nAs th e negative and
Scilab code Exa 6.9 Example on AC Wave Shapes 1
2 // l et us ass um e V=1 V, T=1 sec 3 //e=V ∗ t /T
4 V =1 5 T =1
6 Erms= sqrt(integrate (” (V∗ t/T)ˆ2” ,” t ”,0, T)/T ) 7 mprintf (”RMS value of volt age is %f times maximum
voltage \ n ”,Erms/V)
8 Emean= integrate (”V∗ t/T”,” t ”,0,T)/T 9 k=Erms/Emean
10 mprintf (”F orm fa ct or of th is wave=%f” ,k )
Scilab code Exa 6.10 Example on AC Wave Shapes 1
2 // the gra ph is drawn con sid eri ng R=%pi 3 R=%pi
4 theta= linspace (-%pi ,%pi ,100) 5 V =sqrt(R^2-theta^2)
6 plot2d (theta,V)
7 xtitle (”Wave sha pe fo r ex am pl e 6.10 ” ,” th et a ”,” Voltage” )
8 theta= linspace (%pi ,3*%pi ,100) 9 V = -sqrt(R^2-(theta -2*%pi)^2) 10 plot2d (theta,V)
11
12 Vrms= sqrt(integrate ( ’ (Rˆ2 −xˆ 2) /(2 ∗R) ’, ’ x ’,-R,R))
Figure 6.4: Example on AC Wave Shapes
13 mprintf (”RMS value of su ch a wave sh ap e wil l be %f of i t s maximum volt age ” ,Vrms/R)
Scilab code Exa 6.11 Example on Phase Difference 1
2 // consi der part ( i ) 3 phi=%pi/12
4 mprintf (”F or part ( i ) \ nV ol ta ge leads th e curr ent wav e by % d deg rees \n ”,round (phi*180/%pi)) 5 f=377.16/(2*%pi)
6 mprintf (”Freque ncy of the wav e shape =%d H z \n ”,f ) 7 // consi der part ( i i )
8 phi=%pi/3
9 mprintf (”Fo r part ( i i ) \ nV ol ta ge leads th e cur ren t by
%d degrees \n ”,round (phi*180/%pi))
10 mprintf (”Freque ncy of the wav e shape =ome ga/(2 ∗ p i ) \ n ” )
11 // con sid er part ( i i i ) 12 phi=0-(-%pi/2)
13 mprintf (”Fo r part ( i i i ) \ nV ol ta ge leads th e cur rent wav e by % d deg rees \n ”,round (phi*180/%pi))
14 mprintf (”Freque ncy of the wav e shape =ome ga/pi \n ”) 15 // consi der part ( iv )
16 mprintf (”F or part ( iv ) \ nC ur re nt wave lags the volt age by an angle= alpha +ata n (x/ R) and the freq uenc y of this wave sh ap e is omega/(2 ∗ pi )” )
Scilab code Exa 6.13 Example on Simple AC Circuits 1
2 V=230 // applied voltage 3 L=60D-3 // in duc ta nc e of coi l
4 f=50 // frequency of supp ly 5 Xl=2*%pi*f*L
6 I=230/Xl
7 // i f freq uenc y is re du ce d to 20 Hz 8 Xl=2*%pi*20*L
9 I1=V/Xl
10 mprintf (”Cu rr e nt th ro ug h th e coi l i f fre que ncy is reduced to 20 Hz=%f A \n ”,I1)
11 // i f fre que ncy is increas ed to 60 Hz 12 Xl=2*%pi*60*L
13 I2=V/Xl
14 mprintf (”Cu rr e nt th ro ug h th e coi l i f fre que ncy is increa sed to 60 Hz=%f A \n ”,I2)
15 // i f fre que ncy is increas ed to 1 0 0 Hz 16 Xl=2*%pi*100*L
17 I3=V/Xl
18 mprintf (”Cu rr e nt th ro ug h th e coi l i f fre que ncy is inc rea sed to 10 0 Hz=%f A \ n”,I3)
Scilab code Exa 6.14 Example on Simple AC Circuits 1
2 // calculating re act anc e of capa cit or 3 C=100D-6
4 Xc=1/(2*%pi*50*C)
5 mprintf (” Ca pa cit iv e rea ctan ce ,X c=%f ohm \ n ”,Xc) 6 // calc ulat ing RMS val ue of curren t
7 V=200 8 Irms=V/Xc
9 mprintf (”RMS value of cur ren t=%f A \ n ”,Irms) 10 // calc ulat ing max curren t
11 Imax=Irms* sqrt(2)
12 mprintf (”Maximum c u r r e n t=%f A” ,Imax)
Chapter 7
AC Series Circuit
Scilab code Exa 7.1 Example on AC Series Circuit 1
2 / / calculating cur re nt flo wi ng in t he circu it 3 L=0.1 // induc tance
4 f=50 // frequ ency 5 Xl=2*%pi*f*L
6 R=15 // tota l resista nce in t h e circuit 7 Z =sqrt(R^2+Xl^2)
8 V=230 // vo lt ag e ap pl ie d t o series circuit 9 I=V/Z
10 mprintf (”Cu rr e nt flow ing in th e cir cui t=%f A \ n ”,I ) 11 // calculat ing power factor
12 pf=R/Z
13 mprintf (”P ower factor of th e circu it is %f( lag gin g ) \ nVo lta ge acros s react or= %f V \ nV ol ta ge across
re si st or= %f V”,pf,I*Xl,I*R)
Scilab code Exa 7.2 Example on AC Series Circuit
1
2 V1=200 // voltage applied to non −induct ive lo ad 3 I1=20 // curren t flowing th ro ug h th e loa d
4 R=V1/I1
5 V=230 // app lie d vol tag e to serie s co nn ec ti on of R a nd L
6 I=I1 7 Z=V/I
8 Xl =sqrt(Z^2-R^2) 9 L=Xl/(2*%pi*50) 10 phi=atand(Xl/R)
11 mprintf (”Induc tan ce of th e reactor= %f H, ph as e angl e b e tw e en appl ied volt age and th e cur ren t is %f deg ree s ”,L,phi)
Scilab code Exa 7.3 Example on AC Series Circuit 1
2 // calc ulat ing resistan ce , reactanc e and im pe da nc e of ch ok e coi l
3 I=7.5 // cur ren t flow ing th ro ug h th e cir cui t 4 V1=110 // voltage across non −in du ct iv e resistor 5 R=V1/I
6 V2=180 // volta ge across ch ok e coi l 7 Z=V2/I
8 Zt=230/I //im pe da nc e of wh ol e ci rc ui t 9 r=(Zt^2-R^2-Z^2)/(2*R)
10 Xl =sqrt(Z^2-r^2)
11 mprintf (”Reacta nce of co il= %f o hm \ nResi stanc e of coil=%f ohm \ nIm pe dan ce of c o i l=%f o hm \ n ”,Xl,r,Z) 12 // calculat ing total resist ance and i m p e d a n c e of th e
circuit 13 Rt=r+R
14 Zt =sqrt(Rt^2+Xl^2)
15 mprintf (”To ta l resist ance of cir cui t=%f o hm \ nTotal
imp ed anc e of ci rc ui t=%f o hm \ n ”,Rt,Zt) 16 // calculat ing power ab so rb ed by th e coi l 17 P1=I^2*r
18 mprintf (”P ower absorb ed by the co i l=%f W \n ”,P1) 19 // calc ulat ing power drawn by ci rc ui t
20 P2=I^2*(r+R)
21 mprintf (”P ower drawn by the ci rc u it= %f W \n ”,P2) 22 // calculating power factor of w h o l e circu it 23 pf=Rt/Zt
24 mprintf (”P ower facto r of th e who le ci rc ui t=%f lag gin g ”,pf)
25 // an sw er s va ry from th e te xt boo k due to rou nd off error
Scilab code Exa 7.4 Example on AC Series Circuit 1
2 // calc ulat ing current drawn at 50 Hz 3 V=220 // volt age appl ied to c ho ke coi l 4 f=50 // frequenc y of supp ly
5 I1=12 // curren t ta ke n by ch ok e co il 6 R1=0 // res ist anc e of coil is negligi ble 7 Xl=V/I1
8 I2=16.5 // curr ent ta ke n by th e res is tor 9 R=V/I2
10 Z =sqrt(R^2+Xl^2) 11 I=V/Z
12 mprintf (”Cur re nt ta ke n by th e ci rc ui t at 50 Hz=%f A \ n ”,I )
13 // calc ulat ing current drawn at 30 Hz 14 Xl_dash=30/50*Xl
15 Z_dash= sqrt(Xl_dash^2+R^2) 16 I=V/Z_dash
17 mprintf (”Curr en t drawn by the ci rc ui t at 30 H z=%f A \ n ”,I )
Scilab code Exa 7.5 Example on AC Series Circuit
12 // let resistance and in du ct an ce of th e coil be R and L respectively
3 V=220 // vol tag e app lie d to coil 4 f=50 // frequenc y of supp ly
5 I=60 // current indic ated by ammeter 6 Z1=V/I
7 // when th e fr equ enc y is increase d to 10 0 H z 8 I=40 // current indic ated by ammeter
9 Z2=V/I
10 / /o n sol vin g for L
11 L =sqrt((Z2^2-Z1^2)/3)/(100*%pi) 12 R =sqrt(Z1^2-(100*%pi*L)^2)
13 mprintf (” Resistance of co il= %f ohm \ nInd uct anc e of coil=%f H” ,R,L)
Scilab code Exa 7.6 Example on AC Series Circuit 1
2 // calculat ing pa ra me te rs of e ac h coi l 3 I =3// cur ren t th ro ug h th e cir cui t 4 // for coil A
5 Ra=12/3 // res ist anc e 6 Va=15 // volt age dr op 7 Za=Va/I
8 Xa =sqrt(Za^2-Ra^2) 9 // for coil B
10 Rb=6/3 // res ist anc e 11 Vb=9 // volt age dr op
12 Zb=Vb/I
Scilab code Exa 7.7 Example on AC Series Circuit 1
2 // r 1 be th e variab le resistance
3 X=10 // total indu cti ve re ac tan ce of circu it 4 V=200 //r ms va lu e of appl ied volta ge
5 //RMS val ue of cu rr en t I =2 00 / sq rt ((2 + r1 ) ˆ2+1 0ˆ2) 6 //powe r co nsu me d i s P=I ˆ2 ∗ r 1
7 //For max pow er , dP/dr= 0 8 //o n solving
9 r1 =sqrt (104)
10 mprintf (”V a l u e of var iab le resistor a t t h e ins tan t of max pow er con sum ed in it is %f o hm \ n ”,r1) 11 // solving pa rt ( i i ) , let r2 be th e variable
resistance −I =200/ s q r t ((200 + r2 ) ˆ2+1 0ˆ2) ,P=I ˆ2 ∗(2+
r 2 )
12 // f o r max pow er , dP/dr= 0 13 //o n solving
14 r2=10-2
15 mprintf (”V a l u e of variable res is tor= %d ohm for th e condition of max po wer consumed by th e ci rc ui t \ n ” ,round (r2))
16 I1=200/ sqrt((2+r1)^2+10^2) 17 I2=200/ sqrt((2+r2)^2+10^2) 18 pf1=(2+r1)/ sqrt((2+r1)^2+10^2) 19 pf2=(2+r2)/ sqrt((2+r2)^2+10^2)
20 mprintf (”Curr en t in case ( i )=%f A at %f pf laggi ng \ nC ur re nt in case ( i i )=%f A at %f pf laggi ng \ n ”,I1, pf1,I2,pf2)
Scilab code Exa 7.8 Example on AC Series Circuit
1
2 //bo th th e co il s draw lagging curr ents , he nc e bo th ar e induct ive
3 // for coil A
4 Va=10 // voltage applied 5 Ia=2 // cur ren t dr aw n 6 Za=Va/Ia
7 pf=.8 //p ow er fac tor 8 Ra=pf*Za
9 Xa =sqrt(Za^2-Ra^2) 10 // for coil B
11 Vb=5 // voltage applied 12 Ib=2 // cur ren t dr aw n 13 Zb=Vb/Ib
14 pf=.7 //p ow er fac tor 15 Rb=pf*Zb
16 Xb =sqrt(Zb^2-Rb^2) 17
18 Rt=Ra+Rb // total resist ance of circuit 19 Xt=Xa+Xb // total re act anc e of circu it 20 Z =sqrt(Rt^2+Xt^2)
21 V=Ia*Z 22 pf=Rt/Z
23 mprintf (”V ol t ag e t o be ap pl ie d t o t h e circuit of co il s A and B in se ri es= %f V and pf =%f laggi ng ” ,V ,pf)
Scilab code Exa 7.9 Example on AC Series Circuit 1
2 // calculat ing capa cita nce 3 Xc=4 // capaci tive reactan ce 4 f=50
5 omega=2*%pi*f 6 C=1/(omega*Xc)
7 mprintf (” Capac itan ce C=%f micr oF \ n ”,C*1D+6) 8 // cal cul at in g im pe da nc e
9 R =5// resist ance of circuit 10 Z =sqrt(R^2+Xc^2)
11 mprintf (”Imp ed an ce of ci rc ui t=%f o hm \ n”,Z ) 12 // calculating cur re nt t ak e n by circu it
13 V=200 14 I=V/Z
15 mprintf (”Curr en t drawn by ci rc ui t=%f A \n ”,I ) 16 // calculating vol tag e d r o p acr oss t he resistance 17 Vr=I*R
18 mprintf (”Vol ta ge d r o p across th e resist ance= %f V \n ”, Vr )
19 // calculat ing volt age d r o p across th e reac tanc e 20 Vc=I*Xc
21 mprintf (”Volt age dr op across th e reactanc e=%f V \n ”, Vc )
22 // calculat ing power factor 23 pf=R/Z
24 mprintf (”P ower factor of th e cir cui t=%f leadi ng ” ,pf)
Scilab code Exa 7.10 Example on AC Series Circuit 1
2 // rating of bu lb is 1 00 W,11 0 V 3 P=100
4 V=110
5 I=P/V //no rm al curre nt of bu lb
6 // volt age across bu lb sh ou ld be 11 0 V
7 Vc =sqrt (230^2-V^2) // volt age across th e capa cita nce 8 Xc=Vc/I
9 C=1/(100*%pi*Xc)
10 mprintf (”Capacit ance of %f mi cro F must be conn ect ed in series w i t h t h e b u l b” ,C*1D+6)
Scilab code Exa 7.11 Example on AC Series Circuit 1
2 C=35D-6 // capac itan ce 3 f=50 // frequ ency 4 Xc=1/(2*%pi*f*C)
5 Z=2*Xc // volta ge appl ied across th e capa cit ance is eq ua l t o half of tota l vo lt ag e ap pl ie d
6 R =sqrt(Z^2-Xc^2)
7 mprintf (” Resistance of vari abl e re si st or , R =%f o hm” , R )
Scilab code Exa 7.12 Example on AC Series Circuit 1
2 // calc ulat ing current drawn 3 V=230 // voltage applied
4 R=15+10 // tota l resist ance of t h e circuit 5 L=.04+.1 // tota l indu cta nce
6 Xl=2*%pi*50*L
7 C=100D-6 // capa citan ce 8 Xc=1/(2*%pi*50*C) 9 X=Xl-Xc
10 Z =sqrt(R^2+X^2) 11 I=V/Z
12 mprintf (” Curren t dr aw n=%f A \ n ”,I ) 13 // calc ulat ing voltages V1 and V2 14 Z1 =sqrt (15^2+(2*%pi*50*.04)^2) 15 V1=I*Z1
16 phi1=atand(2*%pi*50*.04/15)
17 mprintf (”V1=%f V a nd leads the current by %f degrees
\ n ”,V1, round (phi1))
18 Z2 =sqrt (10^2+(2*%pi*50*.1-1/(2*%pi*50*100D-6))^2) 19 V2=I*Z2
20 phi2=acosd(10/Z2)
21 mprintf (”V2=%f V a nd lags the current by %f degrees \ n ”,V2,phi2)
22 // calcu lating power fac tor of overa ll circuit 23 pf=R/Z
24 mprintf (”P ower factor of overall cir cui t=%f lagging ” ,pf)
25 //T he ans we rs va ry fro m the text book due to ro un d off er ro r
Scilab code Exa 7.13 Example on AC Series Circuit 1
2 // so lvi ng part ( i )
3 Rb=5 // resist ance of coil B
4 Xb=2*%pi*50*.02 // indu cti ve re ac tan ce of coil B 5 Zb =sqrt(Rb^2+Xb^2)
6 phi_b=atand(Xb/Rb) //ph as e diffe renc e of V b wi t h cu rr en t as referen ce ph as or
7 phi_a=90*%pi/180-phi_b*%pi/180 // Va and V b are in quadrature
8 //Xc/R =tan ( p h i a )
9 //Vb=2 ∗Va−−>Rˆ2+Xcˆ2=Zbˆ2/4 10 //o n solving for R a nd X c
11 R =sqrt((Zb^2/4)/(1+ tan(phi_a)^2)) 12 Xc =tan(phi_a)*R
13 C=1/(2*%pi*50*Xc)
14 mprintf (”R=%f ohm\nC=%f mic roF \n ”,R,C*1D+6) 15 // so lv in g part ( i i )
16 Rt=5+R // total resist ance of circuit
17 Xt=Xb-Xc // result ant re ac tan ce of circu it 18 Zt =sqrt(Rt^2+Xt^2)
19 V=220 // applied voltage
20 I=V/Zt
21 mprintf (”Curr en t drawn by the ci rc ui t=%f A \n ”,I ) 22 // so lv in g part ( i i i )
23 / /a s t h e re ac ta nc e is pos iti ve , circuit is in duc ti ve 24 pf=Rt/Zt // lag gin g
25 mprintf (”P ower facto r of th e ci rc ui t=%f( lagging ) \n ”, 26 // the ans we rs va ry fr om the text book due to ro un dpf )
off er ro r
Scilab code Exa 7.14 Example on AC Series Circuit 1
2 // calculat ing fr equ enc y of appl ied volt age 3 C=25.5D-6 // capa citan ce
4 I=.4 // current th ro ug h ci rc ui t 5 V=50 // volt age across capacitor 6 Xc=V/I
7 f=1/(2*%pi*C*Xc)
8 mprintf (”Frequency=%d Hz \ n ”,round (f)) 9 // calculat ing pa ra me te rs of c h ok e coi l 10 V=35 // volt age across c h ok e coi l
11 Z=V/I //im pe da nc e of ch ok e co il 12 // r ˆ2+(100 ∗ %p i ∗L)ˆ2=Zˆ2
13 R=20/.4
14 Vac=45 // vol tag e acr oss a c por tio n of circu it 15 Zac=Vac/I //im pe da nc e of ac portion
16 // (R+r ) ˆ2+ (10 0 ∗ %p i ∗L)ˆ2=Zacˆ2 17 // solvi ng for r and L
18 r=(Zac^2-Z^2-R^2)/(2*R) 19 L =sqrt(Z^2-r^2)/(100*%pi) 20 Xl=2*%pi*50*L
21 mprintf (”Par am et er s of ch ok e co il : \ nRes is ta nce= %f ohm\ nIndu ctance= %f H \ nInductiv e reacta nce= %f ohm \ n ”,r,L,Xl)
22 // calculat ing appl ied volt age 23 Z =sqrt((R+r)^2+(Xl-Xc)^2) 24 V=I*Z
25 mprintf (”Vol ta ge appl ied to th e cir cui t=%f V \ n ”,V ) 26 // calcu lating losses in c h o k e coil
27 W=I^2*r
28 mprintf (” Losses in ch ok e co il= %d W \ n ”,round (W))
Scilab code Exa 7.15 Example on AC Series Circuit 1
2 // calculat ing capa cita nce to give re son anc e 3 Xl=2*%pi*50*.4
4 Xc=Xl
5 C=1/(2*%pi*50*Xc)
6 mprintf (” Capac itan ce= %f mic roF \n ”,C*1D+6) 7 // calculat ing curr ent
8 R =5 9 Z = R 10 V=110 11 I=V/Z
12 mprintf (” cu rr en t dr aw n=%f A \ n ”,I ) 13 // calculat ing volt age across in duc ta nc e 14 Xl=2*%pi*50*.4
15 Vl=I*Xl
16 mprintf (”Voltag e across inductanc e=%f V \ n ”,Vl) 17 // calculat ing volt age across capa cita nce
18 Xc=Xl 19 Vc=I*Xc
20 mprintf (”Voltag e across capacitance= %f V \n ”,Vc) 21 // calculat ing Q −factor
22 Q_factor=Vl/V
23 mprintf (”Q−factor of t he circu it= %f” ,Q_factor)
Chapter 8
AC Parallel Circuit
Scilab code Exa 8.1 Example on Phasor Method 1
2 function [r,theta]=rect2pol(A) 3 x =real( A )
4 y =imag( A ) 5 r =sqrt(x^2+y^2) 6 theta=atand(y/x) 7 endfunction
8 function [z]=pol2rect(r,theta) 9 x=r* cos(theta*%pi/180) 10 y=r* sin(theta*%pi/180)
11 z=x+y*%i
12 endfunction
13 function [r]=mag(A) 14 x =real( A ) 15 y =imag( A ) 16 r =sqrt(x^2+y^2) 17 endfunction
18 // calculat ing curr ent in e ac h br an c h and its ang le of la g o r le ad
19 V=230 20 f=50
21 // fo r br anc h A 22 Ra=10 // res ist anc e 23 L=.04 // induc tance
24 Xl=2*%pi*f*L // inductive reactan ce 25 Za =sqrt(Ra^2+Xl^2) //impedance 26 Ia=V/Za
27 phi_a=atand(Xl/Ra) 28 // for br an ch B 29 R=25 // res ist anc e 30 Zb=R //impedance 31 Ib=V/Zb
32 phi_b=0
33 mprintf (”Cur re nt in br an ch A , Ia =%f A lagging th e
33 mprintf (”Cur re nt in br an ch A , Ia =%f A lagging th e