summaryrefslogtreecommitdiff
path: root/Problems_in_Electrical_Engineering_by_Parker_Smith/Chapter1.ipynb
diff options
context:
space:
mode:
authorTrupti Kini2016-07-01 23:30:25 +0600
committerTrupti Kini2016-07-01 23:30:25 +0600
commit2ae7e6dfd54f59351714c61c16b95bf24607253b (patch)
treebdab148806983ff4c3de3c6f6767346465c6089f /Problems_in_Electrical_Engineering_by_Parker_Smith/Chapter1.ipynb
parent2609c37e7181bfc62ef244495287dcc8af721e40 (diff)
downloadPython-Textbook-Companions-2ae7e6dfd54f59351714c61c16b95bf24607253b.tar.gz
Python-Textbook-Companions-2ae7e6dfd54f59351714c61c16b95bf24607253b.tar.bz2
Python-Textbook-Companions-2ae7e6dfd54f59351714c61c16b95bf24607253b.zip
Added(A)/Deleted(D) following books
A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter10_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter11_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter12_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter13_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter14_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter15_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter16_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter17_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter18_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter19_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter1_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter20_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter21_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter22_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter23_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter24_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter25_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter26_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter2_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter6_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter7_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter8_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/chapter9_1.ipynb A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/screenshots/chapter10_ac_load_line_1.png A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/screenshots/chapter18_clipping_ckt_output_1.png A Principles_of_Electronics_____by_V.K._Mehta_and_Rohit_Mehta/screenshots/chapter8_dc_load_line_1.png A Problems_in_Electrical_Engineering_by_Parker_Smith/Chapter1.ipynb A Problems_in_Electrical_Engineering_by_Parker_Smith/screenshots/VgnES.png A Problems_in_Electrical_Engineering_by_Parker_Smith/screenshots/f4att.png A Problems_in_Electrical_Engineering_by_Parker_Smith/screenshots/starNdelta.png
Diffstat (limited to 'Problems_in_Electrical_Engineering_by_Parker_Smith/Chapter1.ipynb')
-rw-r--r--Problems_in_Electrical_Engineering_by_Parker_Smith/Chapter1.ipynb3260
1 files changed, 3260 insertions, 0 deletions
diff --git a/Problems_in_Electrical_Engineering_by_Parker_Smith/Chapter1.ipynb b/Problems_in_Electrical_Engineering_by_Parker_Smith/Chapter1.ipynb
new file mode 100644
index 00000000..566ba120
--- /dev/null
+++ b/Problems_in_Electrical_Engineering_by_Parker_Smith/Chapter1.ipynb
@@ -0,0 +1,3260 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Appendix - Solved problems"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 2 Page 340"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 49,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Voltage Gradients :\n",
+ " for A : 1622 V/cm\n",
+ " for B : 1216 V/cm\n",
+ " for C : 811 V/cm\n",
+ "\n",
+ "Energy stored :\n",
+ " for A : 21.9 uJ\n",
+ " for B : 41.1 uJ\n",
+ " for C : 38.3 uJ\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import pi\n",
+ "# Given\n",
+ "t1=2# # mm \n",
+ "t2=5# # mm \n",
+ "t3=7# # mm \n",
+ "eps1=3 # dielectric constant\n",
+ "eps2=4 # dielectric constant\n",
+ "eps3=6# # dielectric constant\n",
+ "eps0=1/36/pi*10**-9# # dielectric constant\n",
+ "d=10/100 # m\n",
+ "V=1500 # V \n",
+ "#E1*t1+E2*t2+E3*t3=V\n",
+ "#Voltage Gradients : \n",
+ "# using eps1*E1=eps2*E2=eps3*E3\n",
+ "E1=V/(t1+(eps1/eps2)*t2+(eps1/eps3)*t3)# V/mm \n",
+ "E1=E1*10 # V/cm\n",
+ "E2=eps1*E1/eps2 # V/cm\n",
+ "E3=eps1*E1/eps3 # V/cm\n",
+ "print \"Voltage Gradients :\\n for A : %.f V/cm\\n for B : %.f V/cm\\n for C : %.f V/cm\"%(E1,E2,E3)\n",
+ "\n",
+ "A = pi*d**2\n",
+ "W1=1/2*eps0*eps1*E1**2*10**4*A*t1*10**-3# # J\n",
+ "W2=1/2*eps0*eps2*E2**2*10**4*A*t2*10**-3# # J\n",
+ "W3=1/2*eps0*eps3*E3**2*10**4*A*t3*10**-3# # J\n",
+ "W1=W1*10**6 # # uJ\n",
+ "W2=W2*10**6 # # uJ\n",
+ "W3=W3*10**6 # # uJ\n",
+ "print \"\\nEnergy stored :\\n for A : %.1f uJ\\n for B : %.1f uJ\\n for C : %.1f uJ\"%(W1,W2,W3)\n",
+ "\n",
+ "\n",
+ "# Answer in the textbook are not accurate"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 3 Page 341"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 50,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Current required = 1.95 A\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import pi\n",
+ "\n",
+ "# Given\n",
+ "N=680# # turns\n",
+ "fi=1.6*10**3 # Wb\n",
+ "d1=4/100 # m\n",
+ "d2=24/100 # m\n",
+ "l=0.6 # m\n",
+ "mu0=4*pi/10**7 # constant\n",
+ "\n",
+ "\n",
+ "# For air gap : \n",
+ "A=d1**2 # m**2\n",
+ "Bg=fi/A # weber/m**2\n",
+ "Hg=Bg/mu0 # AT/m\n",
+ "mmf1=0.001/mu0 # AT\n",
+ "\n",
+ "# For central limb : \n",
+ "A=d1**2 # m**2\n",
+ "Bc=fi/A # weber/m**2\n",
+ "Hc=900 # AT/m (from magnetization curve)\n",
+ "mmf2=Hc*d2 # AT\n",
+ "\n",
+ "\n",
+ "# For side limb : \n",
+ "fi=1/2*fi # Wb\n",
+ "A=d1**2 # m**2\n",
+ "Bc=fi/A # weber/m**2\n",
+ "Hc=520 # AT/m (from magnetization curve)\n",
+ "mmf3=Hc*l # AT\n",
+ "\n",
+ "mmf_total = mmf1+mmf2+mmf3 # AT\n",
+ "i=mmf_total/N # A\n",
+ "print \"Current required = %0.2f A\"%(i)\n",
+ "\n",
+ "\n",
+ "# Answer in the textbook are not accurate"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 4 Page 343"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 51,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\t\t\tWithout air gap With air gap\n",
+ "\n",
+ "Exciting current 3.75 A 11.7 A\n",
+ "\n",
+ "Inductance 5.3 mH 1.7 mH\n",
+ "\n",
+ "Stored Energy 0.375 J 1.17 J\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import pi\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "D=15/100 # m\n",
+ "A=10/10**-4 # m**2\n",
+ "N=200# # turns\n",
+ "fi=1.6*10**3 # Wb\n",
+ "B=1 # weber/m**2\n",
+ "mu0=4*pi/10**7 # constant\n",
+ "mur=500 # constant\n",
+ "lg=2/1000 # m\n",
+ "\n",
+ "\n",
+ "# without air gap\n",
+ "l=pi*D # m\n",
+ "R=l/mu0/mur/A # A/Wb\n",
+ "fi=B*A # Wb\n",
+ "mmf=fi*R # AT\n",
+ "I=mmf/N # A\n",
+ "L=N**2/R/10**6 # mH\n",
+ "E=1/2*L*I**2/100 # J\n",
+ "\n",
+ "\n",
+ "# with air gap\n",
+ "Rg=lg/mu0/A # A/Wb\n",
+ "Rt=R+Rg # A/Wb\n",
+ "fi=B*A # Wb\n",
+ "mmf=fi*Rt # AT\n",
+ "I2=mmf/N # A\n",
+ "L2=N**2/Rt/10**6 # mH\n",
+ "E2=1/2*L2*I2**2/100 # J\n",
+ "\n",
+ "print \"\\t\\t\\tWithout air gap With air gap\"\n",
+ "print \"\\nExciting current %.2f A %.1f A\"%(I,I2)\n",
+ "print \"\\nInductance %.1f mH %.1f mH\"%(L,L2)\n",
+ "print \"\\nStored Energy %.3f J %.2f J\"%(E,E2)\n",
+ "\n",
+ "\n",
+ "# Answer in the textbook are not accurate"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 5 Page 344"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 52,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Voltage acroos 100 ohm = -72.0 V\n",
+ "\n",
+ "R=37.5 ohm\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from numpy import array\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "VA=60 # V\n",
+ "I=0.6 # A\n",
+ "# (VB-VA)/20+(VB-VC)/20+VB/20-I=0\n",
+ "#3*VB-VC=72 for node B eqn(1)\n",
+ "#(VC-VA)/50+(VC-VB)/30+(VC-12)/50+VC/100=0\n",
+ "#-5*VB+10*VC=144 eqn(2)\n",
+ "A=array([[3, -1],[-5 ,10]])\n",
+ "B=array([[72],[144]])\n",
+ "X=A**-1*B#\n",
+ "VB=X[0,0] # V\n",
+ "VC=X[0,1] # V\n",
+ "print \"Voltage acroos 100 ohm = %.1f V\"%(VC)\n",
+ "VC=24 # V\n",
+ "VB=(72+VC)/3 # from eqn(1)\n",
+ "# Node C \n",
+ "# (VC-VA)/50+(VC-VB)/20+(VC-12)/50+VC/100+VC/R=0 eqn(3)\n",
+ "R=100*VC/(144+5*VB-10*VC) # ohm\n",
+ "print \"\\nR=%.1f ohm\"%(R)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 6 Page 346"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 53,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "at f = 2.34 kHz, the above filter will have required attenuation.\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import pi,cosh\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "Ro=600 # ohm\n",
+ "fc=2*1000 # Hz\n",
+ "alfa=10 # dB\n",
+ "\n",
+ "\n",
+ "L=Ro/pi/fc*1000 # mH\n",
+ "C=1/(pi*Ro*fc)*10**6 # uF\n",
+ "alfa=alfa/8.686 # nepers\n",
+ "f=fc*cosh(alfa/2)/1000 # kHz\n",
+ "print \"\\nat f = %.2f kHz, the above filter will have required attenuation.\"%(f)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 7 Page 347"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 54,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "equation for instant current:\n",
+ "i=2.13*sin(314*t+1.01)\n",
+ "Power consumed = 56.6 W\n",
+ "Voltage across capacitor = 73.3 V(+ve & -ve)\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import pi,atan,sqrt,asin,sin\n",
+ "\n",
+ "# Given\n",
+ "#v=100*sin(314*t)\n",
+ "R=25 # ohm\n",
+ "C=80 # uF\n",
+ "omega=314 # radian\n",
+ "Vm=100 # V\n",
+ "\n",
+ "Xc=1/omega/(C*10**-6) # ohm\n",
+ "Z=sqrt(R**2+Xc**2) # ohm\n",
+ "Im=Vm/Z # A\n",
+ "theta=atan(Xc/R) # radian\n",
+ "print \"equation for instant current:\"\n",
+ "print \"i=%.2f*sin(%d*t+%.2f)\"%(Im,omega,theta)\n",
+ "P=(Im/sqrt(2))**2*R # W\n",
+ "print \"Power consumed = %.1f W\"%(P)\n",
+ "Vcm=Im*Xc # V \n",
+ "#(when i=Im/2)\n",
+ "i=0.5*Im # A\n",
+ "#vc=Vcm*sin(314*t+theta-pi/2)\n",
+ "#i=Im*sin(314*t+theta)\n",
+ "tt=asin(i/Im) # radian tt=314*t+theta\n",
+ "vcm=Vcm*sin(tt-pi/2)\n",
+ "print \"Voltage across capacitor = %.1f V(+ve & -ve)\"%(abs(vcm))"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 8 Page 348"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 55,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Capacitance of XC = 318 uF\n",
+ "Circuit current = 10 A and power = 1 kW\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from numpy import pi,roots\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "Z1=(6.25+1J*1.25) # ohm\n",
+ "Z2=(5+1J*0) # ohm\n",
+ "#Z3=(5-1J*XC) # ohm\n",
+ "V=100 # V\n",
+ "f=50 # Hz\n",
+ "#Z23=(250+5*Xc**2)/(100+Xc**2)-1J*(25*Xc)/(100+Xc**2)\n",
+ "#for in phase condition imag part must be zero\n",
+ "#5*Xc**2-100*Xc+5*100=0\n",
+ "A=[5 ,-100, 500] # polynomal \n",
+ "XC=roots(A)#\n",
+ "XC=XC[0] # ohm\n",
+ "C=1/(2*pi*f*XC)*10**6 # uF\n",
+ "print \"Capacitance of XC = %.f uF\"%(C)\n",
+ "Z=XC # ohm\n",
+ "I=V/Z # A\n",
+ "P=I**2*Z/1000 # kW\n",
+ "print \"Circuit current = %.f A and power = %.f kW\"%(I,P)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 9 Page 349"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 56,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "L = 10.4 mH\n",
+ " C=267 uF\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import pi\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "omega_o=600 # rad/s\n",
+ "omega=400 # rad/s\n",
+ "R=3 # ohm\n",
+ "IBYIo=1/2 # ratio\n",
+ "\n",
+ "\n",
+ "fo=omega_o/2/pi # Hz\n",
+ "f=omega/2/pi # Hz\n",
+ "#I/Io=1/(sqrt(1+Q**2*(f/fo-fo/f)**2))\n",
+ "Q=sqrt(1/IBYIo**2-1)/(fo/f-f/fo)\n",
+ "#Q=1/omega_0/R/C\n",
+ "C=1/omega_o/R/Q*10**6 # uF\n",
+ "#Q=omega_0*L/R\n",
+ "L=Q*R/omega_o*1000 # mH\n",
+ "print \"L = %.1f mH\\n C=%.f uF\"%(L,C)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 10 Page 350"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 57,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Star Connection : P=1.6 kW\n",
+ "Delta Connection : P=4.8 kW\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import pi,sqrt\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "V=400 # V\n",
+ "f=50 # Hz\n",
+ "n=3 # no of phase\n",
+ "R=100 # ohm\n",
+ "\n",
+ "#Star connection\n",
+ "Vph=V/sqrt(n) # V\n",
+ "Iph=Vph/R # A\n",
+ "IL=Iph # A\n",
+ "cos_fi=1 # for only resitor load\n",
+ "P=sqrt(3)*V*IL*cos_fi/1000 # kW\n",
+ "print \"Star Connection : P=%.1f kW\"%(P)\n",
+ "#Delta Connection\n",
+ "\n",
+ "Vph=V # V\n",
+ "Iph=Vph/R # A\n",
+ "IL=sqrt(3)*Iph # A\n",
+ "VL=Vph # V\n",
+ "P=sqrt(3)*VL*IL*cos_fi/1000 # kW\n",
+ "print \"Delta Connection : P=%.1f kW\"%(P)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 11 Page 351"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 58,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Phase Current:\n",
+ "Iab=10 angle=-53.13 degree \n",
+ "Ibc=10 angle=-156.87 degree \n",
+ "Ica=20 angle=156.87 degree \n",
+ "\n",
+ "\n",
+ " Line Current:\n",
+ "Iaa=29 angle=-33.03 degree \n",
+ "Ibb=10 angle=165.00 degree \n",
+ "Icc=15 angle=127.97 degree \n",
+ "\n",
+ "\n",
+ " Total Power, W=3 kW\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from numpy import exp,pi\n",
+ "import cmath as cm\n",
+ "# Given\n",
+ "Rab=6;Rbc=8;Rca=4 # ohm\n",
+ "Vab=100*exp(1J*0) # V\n",
+ "Vbc=100*exp(1J*-120*pi/180) # V\n",
+ "Vca=100*exp(1J*120*pi/180) # V\n",
+ "Zab=6+1J*8 # ohm\n",
+ "Zbc=8+1J*6 # ohm\n",
+ "Zca=4-1J*3 # ohm\n",
+ "\n",
+ "#Phase current\n",
+ "Iab=Vab/Zab # A\n",
+ "Ibc=Vbc/Zbc # A\n",
+ "Ica=Vca/Zca # A\n",
+ "print \"Phase Current:\"\n",
+ "print \"Iab=%.f angle=%.2f degree \"%(abs(Iab),cm.phase(Iab)*180/pi)\n",
+ "print \"Ibc=%.f angle=%.2f degree \"%(abs(Ibc),cm.phase(Ibc)*180/pi)\n",
+ "print \"Ica=%.f angle=%.2f degree \"%(abs(Ica),cm.phase(Ica)*180/pi)\n",
+ "#Line current\n",
+ "Iaa=Iab-Ica # A\n",
+ "Ibb=Ibc-Iab # A\n",
+ "Icc=Ica-Ibc # A\n",
+ "print \"\\n\\n Line Current:\"\n",
+ "print \"Iaa=%.f angle=%.2f degree \"%(abs(Iaa),cm.phase(Iaa)*180/pi)\n",
+ "print \"Ibb=%.f angle=%.2f degree \"%(abs(Iab),cm.phase(Ibb)*180/pi)\n",
+ "print \"Icc=%.f angle=%.2f degree \"%(abs(Icc),cm.phase(Icc)*180/pi)\n",
+ "#Power Consumed\n",
+ "Wab=abs(Iab)**2*Rab # W\n",
+ "Wbc=abs(Ibc)**2*Rbc # W\n",
+ "Wca=abs(Ica)**2*Rca # W\n",
+ "W=Wab+Wbc+Wca # W\n",
+ "W=W/1000 # kW\n",
+ "print \"\\n\\n Total Power, W=%.f kW\"%(W)\n",
+ "#Answer wrong for line current in the textbook."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 12 Page 353"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 59,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Wattmeter W1 reading=0 W\n",
+ "Wattmeter W2 reading=8000 W or 8 kW\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from numpy import exp,pi\n",
+ "import cmath as cm\n",
+ "\n",
+ "# Given\n",
+ "VRY=200*exp(1J*0) # V\n",
+ "VYB=200*exp(1J*-120*pi/180) # V\n",
+ "VBR=200*exp(1J*120*pi/180) # V\n",
+ "\n",
+ "\n",
+ "ZA=10*exp(1J*60*pi/180) # ohm\n",
+ "ZB=10*exp(1J*0*pi/180) # ohm\n",
+ "ZC=10*exp(1J*60*pi/180) # ohm\n",
+ "\n",
+ "#Phase current\n",
+ "IRY=VRY/ZA # A\n",
+ "IYB=VYB/ZB # A\n",
+ "IBR=VBR/ZC # A\n",
+ "\n",
+ "IR=IRY-IBR # A\n",
+ "PVA=(VRY).conjugate()*IR # W\n",
+ "print \"Wattmeter W1 reading=%.f W\"%((PVA.real))\n",
+ "IB=IBR-IYB # A\n",
+ "PVB=(-VYB).conjugate()*IB # W\n",
+ "print \"Wattmeter W2 reading=%.f W or %.f kW\"%((PVB.real),(PVB.real)/1000)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 13 Page 354"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 60,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "expression for current:\n",
+ "i = 9.83*sin(omega*t--38.1)+1.0*sin(3*omega*t-7.0)+0.25*sin(5*omega*t-74.3)\n",
+ "Irms=7 A\n",
+ " Vrms=181 V\n",
+ "Total Power, P=977 W\n",
+ "Power factor = 0.77\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from numpy import exp,pi,sqrt\n",
+ "import cmath as cm\n",
+ "# Given\n",
+ "#v=250*sin(omega*t)+50*sin(3*omega*t+pi/3)+20*sin(5*omega*t+5*pi/6)\n",
+ "V1=250;V3=50;V5=20 # V\n",
+ "fi1=0;fi3=60;fi5=150 # degree\n",
+ "R=20 # omh\n",
+ "L=0.05 # H\n",
+ "omega=314 # rad/s\n",
+ "\n",
+ "X1=omega*L # ohm\n",
+ "Z1=R+1J*X1 # ohm\n",
+ "X3=3*omega*L # ohm\n",
+ "Z3=R+1J*X3 # ohm\n",
+ "X5=5*omega*L # ohm\n",
+ "Z5=R+1J*X5 # ohm\n",
+ "r1=abs(Z1);t1=cm.phase(Z1)\n",
+ "r3=abs(Z3);t3=cm.phase(Z3)\n",
+ "r5=abs(Z5);t5=cm.phase(Z5)\n",
+ "print \"expression for current:\"\n",
+ "print \"i = %.2f*sin(omega*t-%.1f)+%.1f*sin(3*omega*t%.1f)+%.2f*sin(5*omega*t-%.1f)\"%(V1/r1,fi1-t1*180/pi,V3/r3,fi3-t3*180/pi,V5/r5,fi5-t5*180/pi)\n",
+ "\n",
+ "I1m=V1/r1 # A\n",
+ "I3m=V3/r3 # A\n",
+ "I5m=V5/r5 # A\n",
+ "Irms=sqrt(I1m**2/2+I3m**2/2+I5m**2/2) # A\n",
+ "Vrms=sqrt(V1**2/2+V3**2/2+V5**2/2) # A\n",
+ "print \"Irms=%.f A\\n Vrms=%.f V\"%(Irms,Vrms)\n",
+ "P=Irms**2*R # W\n",
+ "print \"Total Power, P=%.f W\"%(P)\n",
+ "cosfi=P/Vrms/Irms # Power factor\n",
+ "print \"Power factor = %.2f\"%(cosfi)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 14 Page 355"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 61,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "expression for current:\n",
+ "i = 12.1*sin(314*t-1.263)+0.95*e**(-100*t)\n",
+ "current after 0.02 sec is : -11.4 A\n",
+ "transient component is : 1.56 A\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import pi,exp,sin,atan\n",
+ "\n",
+ "# Given\n",
+ "f=50 # Hz\n",
+ "Vm=400 # V\n",
+ "R=10 # ohm\n",
+ "L=0.1 # H\n",
+ "t=0.02 # sec\n",
+ "XL=2*pi*f*L # ohm\n",
+ "Z=R+1J*XL # ohm\n",
+ "Im=Vm/abs(Z) # A\n",
+ "fi=atan(XL/R) # degree\n",
+ "lamda=L/R # sec\n",
+ "print \"expression for current:\"\n",
+ "print \"i = %.1f*sin(314*t-%.3f)+0.95*e**(-100*t)\"%(Im,fi)\n",
+ "i = Im*sin(314*t-fi)+0.95*exp(-100*t) # A\n",
+ "print \"current after 0.02 sec is : %0.1f A\"%(i)\n",
+ "i2=Im*(0.95*exp(-100*t)) # A\n",
+ "print \"transient component is : %0.2f A\"%(i2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 15 Page 356"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 62,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Since R<2sqrt(L/C), the circuit is originally oscillatory.\n",
+ "Expression for current :\n",
+ " i = 0.000*exp(-50t)*sin(312.2t)\n",
+ "\n",
+ "\n",
+ " Additional resistance required = 1064 ohm\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import pi,sqrt,asin,exp,sin\n",
+ "from sympy import Symbol,solve\n",
+ "from scipy.misc import derivative\n",
+ "\n",
+ "# Given\n",
+ "C=5*10**-6 # F\n",
+ "L=2 # H\n",
+ "R=200 # ohm\n",
+ "\n",
+ "if R<2*sqrt(L/C):\n",
+ " print \"Since R<2sqrt(L/C), the circuit is originally oscillatory.\"\n",
+ "\n",
+ "\n",
+ "a=R/2/L\n",
+ "omega = sqrt(1/L/C-R**2/4/L**2) # rad/s\n",
+ "#i=Im*exp(-a*t)*sin(omega*t+fi)\n",
+ "#at t=0 sec\n",
+ "i0=0 # A\n",
+ "vc=10 # V\n",
+ "fi=asin(i0) # degree\n",
+ "#L*di/dt=vc at t=0\n",
+ "Im=Symbol('Im')\n",
+ "def current(t):\n",
+ " i=Im*exp(-a*t)*sin(omega*t+fi)\n",
+ " return i\n",
+ "#i=Im*expm(-a*t)*sin(omega*t+fi)\n",
+ "\n",
+ "\n",
+ "LdiBYdt=L*derivative(current,0)\n",
+ "#temp = coeff(LdiBYdt)\n",
+ "Im=solve(LdiBYdt,Im)[0]\n",
+ "#vc/temp(2)\n",
+ "print \"Expression for current :\\n i = %.3f*exp(-%dt)*sin(%.1ft)\"%(Im,a,omega)\n",
+ "Rn=2*sqrt(L/C) # ohm\n",
+ "Rad=Rn-R # ohm\n",
+ "print \"\\n\\n Additional resistance required = %d ohm\"%(Rad)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 16 Page 357"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 63,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Reading of hot wire instrument = 0.548 A\n",
+ "Reading of electrostatic voltmeter acroos 1000 ohm = 547 V\n",
+ "Reading of electrostatic voltmeter acroos 1 mH inductor = 353 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import pi,sqrt\n",
+ "\n",
+ "# Given\n",
+ "#i=0.5+0.3*sin(omega*t)-0.2*sin(2*omega*t)\n",
+ "I0=0.5;I1m=0.3;I2m=-0.2 # from above expression\n",
+ "Iav=I0 # A\n",
+ "R=1000 # ohm\n",
+ "L=1/1000 # H\n",
+ "\n",
+ "Irms=sqrt(I0**2+(I1m/sqrt(2)**2+(I2m/sqrt(2)**2))) # A\n",
+ "print \"Reading of hot wire instrument = %.3f A\"%(Irms)\n",
+ "VR=Irms*R # V\n",
+ "print \"Reading of electrostatic voltmeter acroos 1000 ohm = %d V\"%(VR)\n",
+ "#vl_dash=L*di/dt=300*cos(w*t)-400*cos(2*w*t)\n",
+ "vl1=300;vl2=4 # V\n",
+ "vl=sqrt((300/sqrt(2))**2+(400/sqrt(2))**2)\n",
+ "print \"Reading of electrostatic voltmeter acroos 1 mH inductor = %d V\"%(vl)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 17 Page 358"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 64,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The limit of error = 48.6 uV\n",
+ "Deflection = 8.2 mm\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "\n",
+ "# Given\n",
+ "R=80 # ohm\n",
+ "V=2 # V\n",
+ "l=50 # cm\n",
+ "vd=.1 # V\n",
+ "emf=1.43 # V\n",
+ "Rc=850 # ohm\n",
+ "sg=17.5 # mm/uA\n",
+ "df=1 # mm\n",
+ "\n",
+ "\n",
+ "I=R/V # A\n",
+ "Rw=vd/I # ohm (Resistance of side wire)\n",
+ "Id=df/sg*10**-6 # A (current for 1mm deflection)\n",
+ "el=1/sg*Rc # uV\n",
+ "print \"The limit of error = %.1f uV\"%(el)\n",
+ "Rw1=0.2/l*Rw # ohm (for 2cm slide wire)\n",
+ "dV=I*Rw1*1000 # mV (Change in voltage from null point)\n",
+ "r1=emf/I # ohm (tapped portion) \n",
+ "r2=r1*22.8/R # ohm\n",
+ "Ig=dV/1000/(Rc+r2) # A\n",
+ "d=dV/1000/(Rc+r2)/Id # mm\n",
+ "print \"Deflection = %.1f mm\"%(d)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 18 Page 359"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 65,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "reading of hot wire ammeter = 0.56 A\n",
+ "reading of moving coil ammeter = 0.30 A\n",
+ "\n",
+ "\n",
+ " Power taken from the mains = 83.3 W\n",
+ "Power dissipated in rectifying device = 67 W\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import pi,sqrt\n",
+ "from sympy.mpmath import quad\n",
+ "\n",
+ "# Given\n",
+ "R=50 # ohm\n",
+ "Vrms=100 # V\n",
+ "Rd1=50 # ohm\n",
+ "Rd2=100 # ohm \n",
+ "\n",
+ "Vm=Vrms/sqrt(2) # V\n",
+ "#v=Vm*sin(theta)\n",
+ "Rf=R+Rd1 # ohm\n",
+ "Rb=R+Rd2 # ohm\n",
+ "#i_f=v/Rf # A\n",
+ "#i_b=v/Rb # A\n",
+ "Irms=1/2/pi*(quad(lambda theta:(sqrt(2)*sin(theta))**2,[0,pi])+quad(lambda theta:(sqrt(2)/3*sin(theta))**2,[pi,2*pi]))\n",
+ "Iav=1/2/pi*(quad(lambda theta:sqrt(2)*sin(theta),[0,pi])+quad(lambda theta:sqrt(2)/3*sin(theta),[pi,2*pi]))\n",
+ "print \"reading of hot wire ammeter = %.2f A\"%(Irms)\n",
+ "print \"reading of moving coil ammeter = %.2f A\"%(Iav)\n",
+ "P=1/2*(Vrms**2/Rf+Vrms**2/Rb) # W\n",
+ "print \"\\n\\n Power taken from the mains = %.1f W\"%(P)\n",
+ "Pc=Irms**2*R # W\n",
+ "Pd=P-Pc # W\n",
+ "print \"Power dissipated in rectifying device = %d W\"%(Pd)\n",
+ "#Answer wrong in the textbook."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 19 Page 361"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 66,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Required potential difference = 500 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import pi,sqrt,sin\n",
+ "\n",
+ "# Given\n",
+ "d=1/100 # m\n",
+ "S=-1/100 # m\n",
+ "Ve=2 # kV\n",
+ "theta=30 # degree\n",
+ "e=1.6*10**-19 # C\n",
+ "m=9.67*10**-31 # kg\n",
+ "\n",
+ "u=sqrt(2*e*Ve*1000/m) # m/s\n",
+ "uy=u*sin(pi/180*theta) # m/s\n",
+ "vy=0 # since final velocity =0\n",
+ "#vy**2-uy**2=2*ay*S\n",
+ "ay=(vy**2-uy**2)/2/S # m**2/s\n",
+ "#ay=e/m*V/d\n",
+ "V=ay*m*d/e # V\n",
+ "print \"Required potential difference = %.f V\"%(V)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 20 Page 361"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 67,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Amplification factor, mu = -40\n",
+ "Mutual conductance, gm = 2.74 S\n",
+ "Plate resistance, ra = 14.6 kohm\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "\n",
+ "# Given\n",
+ "#Ia=0.0004*(Va+40*Vg)**(3/2) # mA --eqn(1)\n",
+ "Va=250 # V\n",
+ "Vg=-3 # V\n",
+ "#mu=delVa/delVg\n",
+ "#differenciation wrt Vg eqn(1)\n",
+ "#(4*10**-6*3/2*(Va+40*Vg))**(1/2)*(mu+40)=0\n",
+ "mu=-40 # constant\n",
+ "print \"Amplification factor, mu = %.f\"%(mu)\n",
+ "#differenciation wrt Va eqn(1)\n",
+ "#delIa/delVa=(4*10**-6*3/2*(Va+40*Vg))**(1/2)*(0+40)\n",
+ "gm=(4*10**-6*3/2)*(Va+40*Vg)**(1/2)*(0+40)*1000 # mA/V or S\n",
+ "print \"Mutual conductance, gm = %.2f S\"%(gm)\n",
+ "#differenciation wrt Ia eqn(1) keeping Vg constant\n",
+ "#1=(4*10**-6)*3/2*(Va+40*Vg)**(1/2)*(delVa/delIa+0)\n",
+ "#ra=delVa/delIa\n",
+ "ra=1/((4*10**-6)*3/2*(Va+40*Vg)**(1/2))\n",
+ "print \"Plate resistance, ra = %.1f kohm\"%(ra/1000)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 21 Page 363"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 68,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "General equation of FM wave is:\n",
+ "v=4*sin(1.57e+08*t+25*sin(2513*t)\n",
+ "\n",
+ "\n",
+ " General equation of PM wave is:\n",
+ "v=4*sin(1.57e+08*t+25*sin(2513*t)\n",
+ "\n",
+ "\n",
+ " Now equation of FM wave is:\n",
+ "v=4*sin(1.57e+08*t+25*sin(12566*t)\n",
+ "\n",
+ "\n",
+ " Now equation of PM wave is:\n",
+ "v=4*sin(1.57e+08*t+25*sin(12566*t)\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import pi\n",
+ "\n",
+ "# Given\n",
+ "fc=25*10**6 # Hz\n",
+ "fm=400 # Hz\n",
+ "Vm=4 # V\n",
+ "Del=10*10**3 # Hz\n",
+ "wc=2*pi*fc # rad/s\n",
+ "wm=2*pi*fm # rad/s\n",
+ "m=Del/fm # modulation index\n",
+ "mf=m;mp=m # modulation index\n",
+ "print \"General equation of FM wave is:\"\n",
+ "print \"v=%d*sin(%.2e*t+%d*sin(%d*t)\"%(Vm,wc,mf,wm)\n",
+ "print \"\\n\\n General equation of PM wave is:\"\n",
+ "print \"v=%d*sin(%.2e*t+%d*sin(%d*t)\"%(Vm,wc,mp,wm)\n",
+ "# Changing modulating frequency\n",
+ "fm_new=2*10**3 # Hz\n",
+ "a=fm_new/fm # increase in angular frequency\n",
+ "print \"\\n\\n Now equation of FM wave is:\"\n",
+ "print \"v=%d*sin(%.2e*t+%d*sin(%d*t)\"%(Vm,wc,mf,a*wm)\n",
+ "print \"\\n\\n Now equation of PM wave is:\"\n",
+ "print \"v=%d*sin(%.2e*t+%d*sin(%d*t)\"%(Vm,wc,mp,a*wm)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 22 Page 363"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 69,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "modulation index = 0.5\n",
+ "carrier power under modulated condition = 5.06 kW\n",
+ "plate circuit efficiency = 75 percent\n",
+ "plate dissipation under unmodulated condition = 1.5 kW\n",
+ "plate dissipation under modulated condition = 1.69 kW\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "\n",
+ "# Given\n",
+ "Ebb=300 # V\n",
+ "Ibb=20 # A\n",
+ "Emm=150 # V\n",
+ "Po=4.5*10**3 # W\n",
+ "\n",
+ "m=Emm/Ebb # modulation index\n",
+ "Pbb=Ebb*Ibb\n",
+ "eta=Po/Pbb*100 # %\n",
+ "P=Po*(1+m**2/2) # W\n",
+ "Pdo=Pbb-Po # W\n",
+ "Pd=Pdo*(1+m**2/2) # W\n",
+ "print \"modulation index = %.1f\"%(m)\n",
+ "print \"carrier power under modulated condition = %0.2f kW\"%(P/1000)\n",
+ "print \"plate circuit efficiency = %.f percent\"%(eta)\n",
+ "print \"plate dissipation under unmodulated condition = %.1f kW\"%(Pdo/1000)\n",
+ "print \"plate dissipation under modulated condition = %.2f kW\"%(Pd/1000)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 23 Page 364"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 70,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Series equivalent circuit:\n",
+ "Rs = 77.7 ohm\n",
+ "Xs = 34.3 ohm\n",
+ "\n",
+ "\n",
+ " Parallel equivalent circuit:\n",
+ "Rp = 92.8 ohm\n",
+ "Xp = 211 ohm\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import cos,pi,sin\n",
+ "# Given\n",
+ "Zo=50 # ohm\n",
+ "VSWR=2 # ratio\n",
+ "#lm=0.2*lamda\n",
+ "lmBYlamda=0.2\n",
+ "betaINTOlamda=2*pi\n",
+ "rho=(VSWR-1)/(VSWR+1) # reflection coefficient\n",
+ "theta=2*betaINTOlamda*lmBYlamda # radian\n",
+ "#exp(j*theta)=cos(theta)+1J*sin(theta)\n",
+ "ZL=Zo*(1-rho*(cos(theta)+1J*sin(theta)))/(1+rho*(cos(theta)+1J*sin(theta))) # ohm\n",
+ "Rs=(ZL.real) # ohm\n",
+ "Xs=abs((ZL.imag)) # ohm(capacitive)\n",
+ "print \"Series equivalent circuit:\"\n",
+ "print \"Rs = %0.1f ohm\"%(Rs)\n",
+ "print \"Xs = %0.1f ohm\"%(Xs)\n",
+ "YL=(1/ZL)*1000 # mS\n",
+ "Rp=1000/(YL.real) # ohm\n",
+ "Xp=1000/(YL.imag) # ohm\n",
+ "print \"\\n\\n Parallel equivalent circuit:\"\n",
+ "print \"Rp = %0.1f ohm\"%(Rp)\n",
+ "print \"Xp = %0.f ohm\"%(Xp)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 24 Page 366"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 71,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "For TE10 mode:\n",
+ "cutoff wavelength = 9 cm\n",
+ "guide wavelength = 3.59 cm\n",
+ "Group velocity = 2.8e+08 m/s\n",
+ "Phase velocity = 3.2e+08 m/s\n",
+ "Characteristic wave impedence = 406 ohm\n",
+ "\n",
+ "\n",
+ " For TM11 mode:\n",
+ "cutoff wavelength = 5 cm\n",
+ "guide wavelength = 4.48 cm\n",
+ "Group velocity = 2.2e+08 m/s\n",
+ "Phase velocity = 4.0e+08 m/s\n",
+ "Characteristic wave impedence = 281 ohm\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import pi,sqrt\n",
+ "\n",
+ "# Given\n",
+ "b=3 # cm\n",
+ "a=4.5 # cm\n",
+ "f=9*10**9 # Hz\n",
+ "v=3*10**10 # cm/s\n",
+ "lamda=v/f # cm\n",
+ "\n",
+ "print \"For TE10 mode:\"\n",
+ "m=1 # for TE10 mode\n",
+ "lamda_c = 2*a/m # cm\n",
+ "rho=sqrt(1-(lamda/lamda_c)**2)\n",
+ "lamda_g=lamda/rho # cm\n",
+ "vg=rho*v # cm/s\n",
+ "vp=v/rho # cm/s\n",
+ "ZTE=120*pi/rho # ohm\n",
+ "\n",
+ "print \"cutoff wavelength = %.f cm\"%(lamda_c)\n",
+ "print \"guide wavelength = %.2f cm\"%(lamda_g)\n",
+ "print \"Group velocity = %.1e m/s\"%(vg/100)\n",
+ "print \"Phase velocity = %.1e m/s\"%(vp/100)\n",
+ "print \"Characteristic wave impedence = %.f ohm\"%(ZTE)\n",
+ "\n",
+ "print \"\\n\\n For TM11 mode:\"\n",
+ "m=1;n=1# for TE10 mode\n",
+ "lamda_c = 2/sqrt((m/a)**2+(n/b)**2) # cm\n",
+ "rho=sqrt(1-(lamda/lamda_c)**2)\n",
+ "lamda_g=lamda/rho # cm\n",
+ "vg=rho*v # cm/s\n",
+ "vp=v/rho # cm/s\n",
+ "ZTM=120*pi*rho # ohm\n",
+ "print \"cutoff wavelength = %.f cm\"%(lamda_c)\n",
+ "print \"guide wavelength = %.2f cm\"%(lamda_g)\n",
+ "print \"Group velocity = %.1e m/s\"%(vg/100)\n",
+ "print \"Phase velocity = %.1e m/s\"%(vp/100)\n",
+ "print \"Characteristic wave impedence = %.f ohm\"%(ZTM)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 25 Page 367"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 72,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "part(a):\n",
+ "For fo>fs, the range of fo : 965 to 2065 kHz\n",
+ "frequency ratio = 2.14\n",
+ "capacitance ratio = 4.58\n",
+ "\n",
+ "\n",
+ " part(b):\n",
+ "For fo>fs, the range of fo : 35 to 1135 kHz\n",
+ "frequency ratio = 32.4\n",
+ "capacitance ratio = 1051.6\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "\n",
+ "# Given\n",
+ "fs_max=1600 # kHz\n",
+ "fs_min=500 # kHz\n",
+ "IF=465 # kHz\n",
+ "\n",
+ "fr=fs_max/fs_min # ratio\n",
+ "C_ratio = fr**2 # Cs_max/Cs_min\n",
+ "#Part (a)\n",
+ "fo_min=IF+fs_min # kHz\n",
+ "fo_max=IF+fs_max # kHz\n",
+ "fr_o=fo_max/fo_min # frequency ratio for oscillator\n",
+ "C_ratio_o = fr_o**2 # Cs_max/Cs_min\n",
+ "print \"part(a):\"\n",
+ "print \"For fo>fs, the range of fo : %.f to %.f kHz\"%(fo_min,fo_max)\n",
+ "print \"frequency ratio = %.2f\"%(fr_o)\n",
+ "print \"capacitance ratio = %.2f\"%(C_ratio_o)\n",
+ "\n",
+ "#Part (b)\n",
+ "fo_min=-IF+fs_min # kHz\n",
+ "fo_max=-IF+fs_max # kHz\n",
+ "fr_o=fo_max/fo_min # frequency ratio for oscillator\n",
+ "C_ratio_o = fr_o**2 # Cs_max/Cs_min\n",
+ "print \"\\n\\n part(b):\"\n",
+ "print \"For fo>fs, the range of fo : %.f to %.f kHz\"%(fo_min,fo_max)\n",
+ "print \"frequency ratio = %.1f\"%(fr_o)\n",
+ "print \"capacitance ratio = %.1f\"%(C_ratio_o)\n",
+ "#ans wrong for part b in the book."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 26 Page 368"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 73,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Resistor values are : \n",
+ "RL=1.60 kohm\n",
+ "Re=0.40 kohm\n",
+ "R1=55.60 kohm\n",
+ "R2=9.34 kohm\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "\n",
+ "# Given\n",
+ "Ic=3 # mA\n",
+ "hfe=45 # unitless\n",
+ "Vcc=12 # V\n",
+ "VBE=0.5 # V\n",
+ "S=0.05 # stability factor\n",
+ "Beta=45 # unitless\n",
+ "\n",
+ "RR=Vcc/2/(Ic*10**-3) # ohm (let RL+Re=RR)\n",
+ "#Re=20% of (Re+Rl)\n",
+ "Re=RR*20/100 # ohm\n",
+ "RL=RR-Re # ohm\n",
+ "Ve=(Ic+Ic/Beta)*10**-3*Re # V\n",
+ "Vb=Ve+VBE # V\n",
+ "#S=Re/Rb=0.5 => Rb=Re/S\n",
+ "R1=Vcc*Re/S/Vb/1000 # kohm\n",
+ "# Vb/Vcc = R2/(R2+R1)\n",
+ "R2=Vb*R1/(Vcc-Vb) # kohm\n",
+ "print \"Resistor values are : \"\n",
+ "print \"RL=%.2f kohm\"%(RL/1000)\n",
+ "print \"Re=%.2f kohm\"%(Re/1000)\n",
+ "print \"R1=%.2f kohm\"%(R1)\n",
+ "print \"R2=%.2f kohm\"%(R2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 27 Page 369"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 74,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "load presented by transformer = 11.8 ohm\n",
+ "load power output = 67.6 W\n",
+ "conversion efficiency = 62.8 percent\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import pi\n",
+ "\n",
+ "# Given\n",
+ "Vcc=50 # V\n",
+ "Vmin=10 # V\n",
+ "Pd=40 # W\n",
+ "\n",
+ "\n",
+ "Vo=Vcc-Vmin # V\n",
+ "K=Vo/Vcc # constant\n",
+ "Rdash=2*Vcc**2/pi/Pd*(K-pi*K**2/4) # ohm\n",
+ "Po=K**2*Vcc**2/2/Rdash # W\n",
+ "eta=pi*K/4*100 # %\n",
+ "\n",
+ "print \"load presented by transformer = %.1f ohm\"%(Rdash)\n",
+ "print \"load power output = %.1f W\"%(Po)\n",
+ "print \"conversion efficiency = %.1f percent\"%(eta)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 28 Page 370"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 75,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "for 2nd stage(CC stage)\n",
+ "current gain = 48.57\n",
+ "Input impedence = 97.14 kohm\n",
+ "Voltage gain = 1.00\n",
+ "\n",
+ "\n",
+ " for 1st stage(CE stage)\n",
+ "current gain = -47.66\n",
+ "Input impedence = 1.08 kohm\n",
+ "Voltage gain = -86.76\n",
+ "Output impedence = 68.57 kohm\n",
+ "Output impedence taking Rc1 into account = 1.94 kohm\n",
+ "\n",
+ "\n",
+ " for overall amplifier\n",
+ "Output impedence = 34.81 ohm\n",
+ "Output impedence taking Re2 into account = 33.65 ohm\n",
+ "current gain = -46.70\n",
+ "Voltage gain = -86.76\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "\n",
+ "# Given\n",
+ "Rs=1000 # ohm\n",
+ "Rc1=2*1000 # ohm\n",
+ "Re2=2*1000 # ohm\n",
+ "#CE configuration\n",
+ "hie=1100 # ohm\n",
+ "hre=2.5*10**-4#\n",
+ "hfe=50#\n",
+ "hoe=25*10**-6 # s\n",
+ "#CC configuration\n",
+ "hic=1.1 # kohm\n",
+ "hrc=1#\n",
+ "hfc=-51#\n",
+ "hoc=25*10**-6 # s\n",
+ "\n",
+ "print \"for 2nd stage(CC stage)\"\n",
+ "AI2=-hfc/(1+hoe*Re2) # current gain\n",
+ "Ri2=hic+hrc*AI2*Re2 # kohm\n",
+ "Av2=AI2*Re2/Ri2 # Voltage Gain\n",
+ "print \"current gain = %0.2f\"%(AI2)\n",
+ "print \"Input impedence = %0.2f kohm\"%(Ri2/1000)\n",
+ "print \"Voltage gain = %0.2f\"%(Av2)\n",
+ "\n",
+ "print \"\\n\\n for 1st stage(CE stage)\"\n",
+ "RL1=Rc1*Ri2/(Rc1+Ri2) # kohm\n",
+ "AI1=-hfe/(1+hoe*RL1) # current gain\n",
+ "print \"current gain = %.2f\"%(AI1)\n",
+ "Ri1=hie+hre*AI1*RL1 # kohm\n",
+ "print \"Input impedence = %0.2f kohm\"%(Ri1/1000)\n",
+ "Av1=AI1*RL1/Ri1 # Voltage gain\n",
+ "print \"Voltage gain = %0.2f\"%(Av1)\n",
+ "Ro1=1/(hoe-hfe*hre/(hie+100)) # ohm\n",
+ "print \"Output impedence = %.2f kohm\"%(Ro1/1000)\n",
+ "Ro1dash=Ro1*Rc1/(Ro1+Rc1) # /ohm\n",
+ "print \"Output impedence taking Rc1 into account = %.2f kohm\"%(Ro1dash/1000)\n",
+ "\n",
+ "print \"\\n\\n for overall amplifier\"\n",
+ "Ro=1/(hoc*100-hfc*hrc/(hic+Ro1dash)) # ohm\n",
+ "print \"Output impedence = %.2f ohm\"%(Ro)\n",
+ "Rodash=Ro*Re2*1000/(Ro1+Re2*1000) # /ohm\n",
+ "print \"Output impedence taking Re2 into account = %.2f ohm\"%(Rodash)\n",
+ "AI=AI1*AI2*Rc1/(Ri2+Rc1) # current gain\n",
+ "print \"current gain = %.2f\"%(AI)\n",
+ "Av=Av1*Av2 # voltage gain\n",
+ "print \"Voltage gain = %.2f\"%(Av)\n",
+ "#answer is wrong for overall amplifier in the book."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 29 Page 372"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 76,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Voltage gain upper BW frequency = 0.37 MHz\n",
+ "Current gain = -13.51\n",
+ "Voltage gain = -27.03\n",
+ "Voltage gain BW product = 9.90 MHz\n",
+ "Current gain BW product = 4.95 MHz\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import pi\n",
+ "\n",
+ "# Given\n",
+ "fT=6*10**6 # Hz\n",
+ "hfe=50#\n",
+ "Rs=500 # ohm\n",
+ "gm=0.04 # S\n",
+ "rbb_dash=100 # ohm\n",
+ "Cc=10*10**-12 # F\n",
+ "RL=1 # kohm\n",
+ "\n",
+ "rbe=hfe/gm # ohm\n",
+ "Ce=gm/2/pi/fT # F\n",
+ "C=Ce+Cc*(1+gm*RL) # F\n",
+ "hie=rbb_dash+rbe # ohm\n",
+ "R=(Rs+rbb_dash)*rbe/((Rs+rbb_dash)+rbe) # ohm\n",
+ "f2=1/2/pi/R/C # Hz\n",
+ "print \"Voltage gain upper BW frequency = %.2f MHz\"%(f2/10**6)\n",
+ "AIS=-hfe*Rs/(Rs+hie) # current gain\n",
+ "print \"Current gain = %.2f\"%(AIS)\n",
+ "AVS=-hfe*RL*1000/(Rs+hie) # voltage gain\n",
+ "print \"Voltage gain = %.2f\"%(AVS)\n",
+ "AVSf2=AVS*f2 # Hz\n",
+ "print \"Voltage gain BW product = %.2f MHz\"%(abs(AVSf2/10**6))\n",
+ "AISf2=AIS*f2 # Hz\n",
+ "print \"Current gain BW product = %.2f MHz\"%(abs(AISf2/10**6))\n",
+ "\n",
+ "#answer in the textbook are wrong."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 30 Page 373"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 77,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "VGS=0.05 V\n",
+ "gm = -13.23 mS\n",
+ "Rs = -49 ohm\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import pi,sqrt\n",
+ "\n",
+ "# Given\n",
+ "VP=-2 # V\n",
+ "IDSS=1.75/1000 # A\n",
+ "VDD=24 # V\n",
+ "ID=1/1000 # A\n",
+ "VP=0.2 # V (pinch off voltage)\n",
+ "\n",
+ "VGS=(1-sqrt(ID/IDSS))*VP # V\n",
+ "gmo=-2*IDSS/VP # S\n",
+ "gm=gmo*(1-VGS/VP) # S\n",
+ "Rs=-VGS/ID # ohm\n",
+ "\n",
+ "print \"VGS=%.2f V\"%(VGS)\n",
+ "print \"gm = %.2f mS\"%(gm*1000)\n",
+ "print \"Rs = %.f ohm\"%(Rs)\n",
+ "#Ans are wrong in the book."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 31 Page 374"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 78,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Bandwidth of redesigned aplifier, BW=101 kHz\n"
+ ]
+ }
+ ],
+ "source": [
+ "from math import sqrt\n",
+ "from __future__ import division\n",
+ "# Given\n",
+ "G=37 # dB\n",
+ "f1=50 # Hz\n",
+ "f2=18.7*1000 # Hz\n",
+ "BW1=f2 # Hz (f2-f1~=f2)\n",
+ "\n",
+ "\n",
+ "A1=10**(G/20) # Gain\n",
+ "A3=sqrt(A1) # Gain\n",
+ "RL1BYRL2=A1/A3 # ratio\n",
+ "RL2BYRL1=A3/A1 # ratio\n",
+ "#BW=2*pi*Cd*RL\n",
+ "BW1BYBW2=RL2BYRL1#\n",
+ "BW2BYBW1=RL1BYRL2#\n",
+ "f2dash=f2*sqrt(sqrt(2)-1)#\n",
+ "BW2=BW2BYBW1*f2dash # Hz\n",
+ "print \"Bandwidth of redesigned aplifier, BW=%.f kHz\"%(BW2/1000)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 32 Page 375"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 79,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "ripple factor = 0.4 percent\n",
+ "Critical inductance, Lc=8.5 H\n"
+ ]
+ }
+ ],
+ "source": [
+ "from math import sqrt\n",
+ "from __future__ import division\n",
+ "\n",
+ "# Given\n",
+ "L=30 # H\n",
+ "C=10*10**-6 # F\n",
+ "RL=8*10**3 # ohm\n",
+ "f=50 # Hz\n",
+ "\n",
+ "r=sqrt(2)/12/(2*pi*f)**2/L/C*100 # %\n",
+ "Lc=2*RL/6/(2*pi*f) # H\n",
+ "print \"ripple factor = %.1f percent\"%(r)\n",
+ "print \"Critical inductance, Lc=%.1f H\"%(Lc)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 33 Page 376"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 80,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Current supplied by the main generator = 7000 A\n",
+ "Current supplied on +ve side = 6000 A\n",
+ "Current supplied on -ve side = 8000 A\n",
+ "out-off balance Current = 2000 A\n",
+ "Current in each armature = 1000 A\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "# Given\n",
+ "V=500 # V\n",
+ "Pp=1500*10**3 # W (+ve side)\n",
+ "Pn=2000*10**3 # W (-ve side)\n",
+ "\n",
+ "P=Pp+Pn # W\n",
+ "I=P/V # A\n",
+ "Ip=Pp/(V/2) # A\n",
+ "In=Pn/(V/2) # A\n",
+ "Iob=In-Ip # A\n",
+ "Ia=Iob/2 # A\n",
+ "print \"Current supplied by the main generator = %.f A\"%(I)\n",
+ "print \"Current supplied on +ve side = %.f A\"%(Ip)\n",
+ "print \"Current supplied on -ve side = %.f A\"%(In)\n",
+ "print \"out-off balance Current = %.f A\"%(Iob)\n",
+ "print \"Current in each armature = %.f A\"%(Ia)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 34 Page 377"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 81,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "regulation = 17 percent\n",
+ "Efficiency = 94 percent\n",
+ "\n",
+ "\n",
+ " regulation = 13.4 percent\n",
+ "Efficiency = 96 percent\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import sqrt\n",
+ "# Given\n",
+ "l=20 # km\n",
+ "P=10000 # kW\n",
+ "V=11 # kV\n",
+ "pf=0.707 # lagging\n",
+ "R=0.02 # ohm/km/phase\n",
+ "X=0.07 # ohm/km/phase\n",
+ "\n",
+ "#for pf = 0.707\n",
+ "\n",
+ "IL=P*10**3/sqrt(3)/(V*1000)/pf # A\n",
+ "VRphase=V*1000/sqrt(3) # V\n",
+ "R_phase=l*R # ohm\n",
+ "X_phase=l*X # ohm\n",
+ "Z_phase=R_phase+1J*X_phase # ohm\n",
+ "Vd_phase=IL*(pf-1J*pf)*Z_phase # V\n",
+ "VS=(Vd_phase+VRphase) # V\n",
+ "regulation=(VS-VRphase)/VRphase*100 # %\n",
+ "print \"regulation = %.f percent\"%abs(regulation)\n",
+ "PL=3*IL**2*R_phase/1000 # kW\n",
+ "Po=P+PL # kW\n",
+ "eta=P/Po*100 # %\n",
+ "print \"Efficiency = %.f percent\"%(eta)\n",
+ "\n",
+ "#for pf2=0.9 # lagging\n",
+ "pf=0.9 # lagging\n",
+ "IL=P*10**3/sqrt(3)/(V*1000)/pf # A\n",
+ "VRphase=V*1000/sqrt(3) # V\n",
+ "R_phase=l*R # ohm\n",
+ "X_phase=l*X # ohm\n",
+ "Z_phase=R_phase+1J*X_phase # ohm\n",
+ "Vd_phase=IL*(pf-1J*.435)*Z_phase # V\n",
+ "VS=(Vd_phase+VRphase) # V\n",
+ "regulation=(VS-VRphase)/VRphase*100 # %\n",
+ "print \"\\n\\n regulation = %.1f percent\"%abs(regulation)\n",
+ "PL=3*IL**2*R_phase/1000 # kW\n",
+ "Po=P+PL # kW\n",
+ "eta=P/Po*100 # %\n",
+ "print \"Efficiency = %.f percent\"%(eta)\n",
+ "#ans wrong for 2nd part in the book."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 35 Page 378"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 82,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "lamp1 : Total cost/hour = 0.488 paise\n",
+ "lamp2 : Total cost/hour = 0.61 paise\n",
+ "on comparing cost it is clear lamp1 will be more economical. \n",
+ "\n",
+ "\n",
+ " load factor = 28 percent\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "\n",
+ "# Given\n",
+ "C1=1.2 # Rs\n",
+ "C2=5 # Rs\n",
+ "P1=100 # W\n",
+ "P2=30 # W\n",
+ "t=1000 # hours\n",
+ "Ce=60 # Rs/kW/annum for max demand\n",
+ "Cee=3 # paise/unit for extra\n",
+ "\n",
+ "#first lamp\n",
+ "Cl1=C1*100/t # paise / hour\n",
+ "dmax1=P1/1000 # kW/hour\n",
+ "Cmax1=Ce*100*dmax1/(24*365) # paise/hour\n",
+ "CE1=Cee*dmax1 # /paise / hour\n",
+ "CT1=Cl1+Cmax1+CE1 # paise (total cost per hour)\n",
+ "print \"lamp1 : Total cost/hour = %.3f paise\"%(CT1)\n",
+ "#second lamp\n",
+ "Cl2=C2*100/t # paise / hour\n",
+ "dmax2=P2/1000 # kW/hour\n",
+ "Cmax2=Ce*100*dmax2/(24*365) # paise/hour\n",
+ "CE2=Cee*dmax2 # /paise / hour\n",
+ "CT2=Cl2+Cmax2+CE2 # paise (total cost per hour)\n",
+ "print \"lamp2 : Total cost/hour = %.2f paise\"%(CT2)\n",
+ "print \"on comparing cost it is clear lamp1 will be more economical. \"\n",
+ "#let load factor = x\n",
+ "#Cl1+Cmax1/x+CE1=Cl2+Cmax2/x+CE2\n",
+ "x=(Cmax1-Cmax2)/(Cl2+CE2-Cl1-CE1)*100 # % load factor\n",
+ "print \"\\n\\n load factor = %.f percent\"%(x)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 36 Page 379"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 83,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "(a) extra shunt field turns required = 104\n",
+ "(b) extra shunt field turns required = 52\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "\n",
+ "# Given\n",
+ "p=4 # pole\n",
+ "I1=143 # A\n",
+ "Z=492 # armature conductors\n",
+ "theta=10 # degree\n",
+ "I2=10 # A\n",
+ "\n",
+ "Ia=I1+I2 # A\n",
+ "Iw=Ia/2 # A for wave sound\n",
+ "Il=Ia/4 # for lap sound\n",
+ "#part(a)\n",
+ "ATw=Z*Iw*theta/360 # AT\n",
+ "nw=ATw/theta # turns \n",
+ "print \"(a) extra shunt field turns required = %d\"%(nw)\n",
+ "\n",
+ "#part(b)\n",
+ "ATl=Z*Il*theta/360 # AT\n",
+ "nl=ATl/theta # turns \n",
+ "print \"(b) extra shunt field turns required = %d\"%(nl)\n",
+ "#answer wrong for part(a) in the boko."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 37 Page 380"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 84,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "New speed will be 570 rpm\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from numpy import roots\n",
+ "# Given\n",
+ "Wh=250 # W\n",
+ "We=100 # W\n",
+ "N=1000/60 # rps\n",
+ "\n",
+ "A=Wh/N # constant\n",
+ "B=We/N**2 # constant\n",
+ "Wnew=1/2*(Wh+We) # W\n",
+ "#Wnew=A*N1+B*N1**2\n",
+ "p=[B,A,-Wnew] # polynomial for N1\n",
+ "N1=roots(p) # rps\n",
+ "N1=N1[1]*60 # rpm#discarding -ve vealue\n",
+ "print \"New speed will be %.f rpm\"%(N1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 38 Page 381"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 85,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Speed of the machine running as shunt motor = 381 rpm\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "\n",
+ "# Given\n",
+ "P=50 # kW\n",
+ "V=250#V\n",
+ "N1=400 # rpm\n",
+ "Ra=0.02 # ohm\n",
+ "Rf=50 # ohm\n",
+ "Pi=50 # kW\n",
+ "Vin=250 # V\n",
+ "Vd=1 # V per Brush\n",
+ "\n",
+ "I=P*10**3/V#A\n",
+ "Ish=V/Rf # A\n",
+ "Ia=I+Ish # A\n",
+ "Va=Ia*Ra # V\n",
+ "Vbd=2*Vd # V\n",
+ "Eb1=V+Va+Vbd # V\n",
+ "\n",
+ "\n",
+ "#as motor\n",
+ "I=P*10**3/V#A\n",
+ "Ish=V/Rf # A\n",
+ "Ia=I-Ish # A\n",
+ "\n",
+ "Va=Ia*Ra # V\n",
+ "Vbd=2*Vd # V\n",
+ "Eb2=V-Va-Vbd # V\n",
+ "N2=(Eb2/Eb1)*N1 # rpm\n",
+ "print \"Speed of the machine running as shunt motor = %.f rpm\"%(N2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 39 Page 383"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 86,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Motor efficiency = 92 percent\n",
+ "Generator efficiency = 92 percent\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "\n",
+ "# Given\n",
+ "VL=250 # V\n",
+ "Is=50 # A\n",
+ "Ia=380 # A\n",
+ "If1=5 # A\n",
+ "If2=4.2 # A\n",
+ "ra=0.02 # ohm\n",
+ "\n",
+ "#Machine Losses:\n",
+ "ma_cu_loss=Ia**2*ra # W (motor armature cu loss)\n",
+ "ga_cu_loss=(Ia-Is)**2*ra # W (generator armature cu loss)\n",
+ "P=VL*Is # W\n",
+ "stray_loss=P-ma_cu_loss-ga_cu_loss # W\n",
+ "stray_loss_per_machine=stray_loss/2 # W\n",
+ "\n",
+ "#Motor efficiency\n",
+ "field_cu_loss=VL*If2 # W\n",
+ "total_loss=ma_cu_loss+field_cu_loss+stray_loss_per_machine # W\n",
+ "Pin_motor=(VL*Ia)+(VL*ra) # W\n",
+ "Pout_motor=Pin_motor-total_loss # W\n",
+ "Eff=Pout_motor/Pin_motor*100 # %\n",
+ "print \"Motor efficiency = %.f percent\"%(Eff)\n",
+ "\n",
+ "\n",
+ "#Generator efficiency\n",
+ "field_cu_loss=VL*If1 # W\n",
+ "total_loss=ga_cu_loss+field_cu_loss+stray_loss_per_machine # W\n",
+ "Pout_generator=VL*(Ia-Is) # W\n",
+ "Pin_generator=Pout_generator+total_loss # W\n",
+ "Eff=Pout_motor/Pin_motor*100 # %\n",
+ "print \"Generator efficiency = %.f percent\"%(Eff)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 40 Page 384"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 87,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Full load efficiency : \n",
+ "at unity power factor = 96.8 percent\n",
+ "at 0.8 power factor = 96.0 percent\n",
+ "\n",
+ "\n",
+ " Voltage drop at unity pf = 393.8 V\n",
+ "Voltage drop at 0.8 pf lagging = 384.0 V\n",
+ "Voltage drop at 0.8 pf leading = 406 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import sqrt\n",
+ "# Given\n",
+ "KVA=4 # kVA\n",
+ "V1=200#V\n",
+ "V2=400#V\n",
+ "f=50 # Hz\n",
+ "Io1=0.8 # A\n",
+ "P1=70 # W\n",
+ "Vs2=17.5 # V\n",
+ "Is2=9 # A\n",
+ "P2=50 # W\n",
+ "\n",
+ "#full load\n",
+ "I_loss=P1 # W\n",
+ "I2=KVA*1000/V2 # A\n",
+ "Cu_loss=(I2/Is2)**2*P2 # W\n",
+ "Zo2=Vs2/Is2 # ohm\n",
+ "Ro2=P2/Is2**2 # ohm\n",
+ "Xo2=sqrt(Zo2**2-Ro2**2) # ohm\n",
+ "\n",
+ "#(a) \n",
+ "print \"Full load efficiency : \"\n",
+ "#unity pf\n",
+ "pf=1 # power factor\n",
+ "Output=KVA*pf # kW\n",
+ "Losses=Cu_loss+I_loss # W\n",
+ "eta=Output*1000/(Output*1000+Losses)*100 # %\n",
+ "print \"at unity power factor = %.1f percent\"%(eta)\n",
+ "#0.8 pf\n",
+ "pf=0.8 # power factor\n",
+ "Output=KVA*pf # kW\n",
+ "eta=Output*1000/(Output*1000+Losses)*100 # %\n",
+ "print \"at 0.8 power factor = %.1f percent\"%(eta)\n",
+ "\n",
+ "#(b)\n",
+ "#(i) unity pf\n",
+ "Vd=I2*Ro2 # V\n",
+ "V22=V2-Vd # V\n",
+ "print \"\\n\\n Voltage drop at unity pf = %.1f V\"%(V22)\n",
+ "#(i) 0.8 pf lagging\n",
+ "pf=0.8 # power factor\n",
+ "Vd=I2*(Ro2*pf+Xo2*sqrt(1-pf**2)) # V\n",
+ "V22=V2-Vd # V\n",
+ "print \"Voltage drop at 0.8 pf lagging = %.1f V\"%(V22)\n",
+ "#(i) 0.8 pf leading\n",
+ "pf=0.8 # power factor\n",
+ "Vd=I2*(Ro2*pf-Xo2*sqrt(1-pf**2)) # V\n",
+ "V22=V2-Vd # V\n",
+ "print \"Voltage drop at 0.8 pf leading = %.f V\"%(V22)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 41 Page 385"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 88,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "All day efficiency = 97 percent\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "\n",
+ "# Given\n",
+ "KVA=15 # kVA\n",
+ "pf=1#\n",
+ "eff=98/100 # efficiency\n",
+ "\n",
+ "L1=2 # kW\n",
+ "pf1=0.5 # lagging\n",
+ "t1=12 # hours\n",
+ "L2=12 # kW\n",
+ "pf2=0.8 # lagging\n",
+ "t2=6 # hours\n",
+ "L3=18 # kW\n",
+ "pf3=0.9 # lagging\n",
+ "t3=6 # hours\n",
+ "\n",
+ "Po=KVA*pf # kW\n",
+ "Pin=Po/eff # kW\n",
+ "Losses=Pin-Po # kW\n",
+ "Cu_loss=Losses/2 # kW\n",
+ "I_loss=Losses/2 # kW\n",
+ "\n",
+ "KVA1=L1/pf1 # kVA\n",
+ "KVA2=L2/pf2 # kVA\n",
+ "KVA3=L3/pf3 # kVA\n",
+ "Cu_loss1=Cu_loss*(KVA1/KVA2)**2 # kW\n",
+ "Cu_loss2=Cu_loss*(KVA2/KVA2)**2 # kW\n",
+ "Cu_loss3=Cu_loss*(KVA3/KVA2)**2 # kW\n",
+ "\n",
+ "Cu_loss_t1=Cu_loss1*t1 # kW\n",
+ "Cu_loss_t2=Cu_loss2*t2 # kW\n",
+ "Cu_loss_t3=Cu_loss3*t3 # kW\n",
+ "Cu_loss_total=Cu_loss_t1+Cu_loss_t2+Cu_loss_t3 # kW\n",
+ "I_loss24=I_loss*24 # Wh\n",
+ "\n",
+ "Po24=L1*t1+L2*t2+L3*t3 # kWh\n",
+ "Pi24=Po24+Cu_loss_total+I_loss24 # kWh\n",
+ "eff_allday=Po24/Pi24*100 # %\n",
+ "print \"All day efficiency = %.f percent\"%(eff_allday)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 42 Page 386"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 89,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Current drawn by the transformer=42.67 A\n",
+ "power factor = 0.9 lagging\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import sqrt\n",
+ "# Given\n",
+ "V1=250 # V\n",
+ "V2=150 # V\n",
+ "Vs1=200 # V\n",
+ "Load1=5 # kW\n",
+ "pf1=0.8 # lagging\n",
+ "Load2=2 # kW\n",
+ "pf2=1 # unity\n",
+ "Vs2=100 # V\n",
+ "\n",
+ "I1=Load1*1000/V1/pf1 # A\n",
+ "t1_ratio=V1/Vs1 # \n",
+ "Ip1=I1*t1_ratio # A at 0.8 pf (current drawn by primary)\n",
+ "\n",
+ "I2=Load2*1000/Vs2/pf2 # A\n",
+ "t2_ratio=Vs2/V2 # \n",
+ "Ip2=I2*t2_ratio # A at 0.8 pf (current drawn by primary)\n",
+ "\n",
+ "Ipx=Ip1*pf1+Ip2 # A\n",
+ "Ipy=Ip1*sqrt(1-pf1**2) # A\n",
+ "I3=sqrt(Ipx**2+Ipy**2) # A\n",
+ "print \"Current drawn by the transformer=%.2f A\"%(I3)\n",
+ "pf=Ipx/I3 # power factor\n",
+ "print \"power factor = %.1f lagging\"%(pf)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 43 Page 387"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 90,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Percentage reduction in stator voltage = 23 percent\n",
+ "power factor = 0.3\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import sqrt,atan,cos\n",
+ "# Given\n",
+ "R2=0.03 # ohm\n",
+ "X2=0.18 # ohm\n",
+ "Ns=100 # rpm\n",
+ "s1=3 # %\n",
+ "\n",
+ "\n",
+ "Nfl=(100-s1) # rpm (full load speed)\n",
+ "N2=Nfl/2 # rpm\n",
+ "s2=(Ns-N2)/Ns*100 # %\n",
+ "V1BYV2=sqrt(s2/s1*(R2**2+(s1/100*X2)**2)/(R2**2+(s2/100*X2)**2)) # from torque equation\n",
+ "#let V1=V12BYV1 V2=1\n",
+ "V1=V1BYV2 # V\n",
+ "V2=1 # V\n",
+ "V12BYV1=(V1-1)/V1*100 # % reduction in the stator (V12=V1-V2)\n",
+ "print \"Percentage reduction in stator voltage = %.f percent\"%(V12BYV1)\n",
+ "fi=atan(s2/100*X2/R2) # radian\n",
+ "pf=cos(fi) # power factor\n",
+ "print \"power factor = %.1f\"%(pf)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 44 Page 388"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 91,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "(a) at standstill, To:Ti = 40:1\n",
+ "(b) at s=0.05, To:Ti = 0.4:1\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import sqrt\n",
+ "\n",
+ "# Given\n",
+ "zo=1+1J*1 # ohm\n",
+ "zi=0.2+1J*4 # ohm\n",
+ "Ri=zi.real # ohm\n",
+ "Ro=(zo).real # ohm\n",
+ "\n",
+ "#at standstill\n",
+ "s=1 # % at standstill\n",
+ "Zo=sqrt((zo).real**2+(zo).imag**2) # ohm\n",
+ "Zi=sqrt((zi).real**2+(zi).imag**2) # ohm\n",
+ "ToBYTi=Ro/Ri*(Zi/Zo)**2 # torque ratio\n",
+ "print \"(a) at standstill, To:Ti = %d:1\"%(ToBYTi)\n",
+ "\n",
+ "#at s=0.5\n",
+ "s=0.05 # %\n",
+ "Zo=sqrt((zo).real**2/s**2+(zo).imag**2) # ohm\n",
+ "Zi=sqrt((zi).real**2/s**2+(zi).imag**2) # ohm\n",
+ "ToBYTi=Ro/Ri*(Zi/Zo)**2 # torque ratio\n",
+ "print \"(b) at s=0.05, To:Ti = %.1f:1\"%(ToBYTi)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 45 Page 389"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 92,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "no. of turns in primary = 582\n",
+ "no. of turns in secondary = 18\n",
+ "\n",
+ "cross section of primary winding=5.24e-04 m**2\n",
+ "cross section of secondary winding=1.7e-05 m**2\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import sqrt\n",
+ "# Given\n",
+ "Edc=500 # V\n",
+ "fim=.085 # Wb\n",
+ "f=50 # Hz\n",
+ "E1=11000 # V\n",
+ "P=1500 # kW\n",
+ "p=8 # pole\n",
+ "pf=0.9\n",
+ "V=500 # V\n",
+ "J=3 # A/mm**2\n",
+ "\n",
+ "E2=Edc/sqrt(2)#V\n",
+ "N2=E2/4.44/f/fim # no. of turns\n",
+ "N1=E1/E2*N2 # no. of turns\n",
+ "print \"no. of turns in primary = %d\"%(N1)\n",
+ "print \"no. of turns in secondary = %d\"%(N2)\n",
+ "Idc=P*10**3/V # A\n",
+ "eta=1 # because of no loss\n",
+ "ISR=0.472*Idc/(eta*pf)\n",
+ "A1=ISR/J*10**-6 # m**2 (cross section area)\n",
+ "I1=N2/N1*ISR # A\n",
+ "A2=I1/J*10**-6 # m**2 (cross section area of primary winding)\n",
+ "print \"\\ncross section of primary winding=%.2e m**2\"%(A1)\n",
+ "print \"cross section of secondary winding=%.1e m**2\"%(A2)\n",
+ "#ans in the book are not accurate."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 46 Page 391"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 93,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Suitable auto transformation ratio = 77.5\n",
+ "Starting torque Tst = 15 percent of full-load torque\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import sqrt\n",
+ "\n",
+ "# Given\n",
+ "IscBYIfl=5 # as Isc=5*Ifl\n",
+ "ILByIfl=3 # as IL <= 3*Ifl\n",
+ "sf=5 # %\n",
+ "\n",
+ "#IL=K**2*ISC\n",
+ "#dividing by Ifl\n",
+ "K=sqrt(ILByIfl/IscBYIfl)*100 # %\n",
+ "TstBYTf=(K/100)**2*IscBYIfl*sf/100*100 # % #ratio of torque\n",
+ "print \"Suitable auto transformation ratio = %.1f\"%(K)\n",
+ "print \"Starting torque Tst = %.f percent of full-load torque\"%(TstBYTf)\n",
+ "#ans wrong in the textbook."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 47 Page 391"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 94,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "no of studs = 5 and no. of section = 4\n",
+ "\n",
+ "Resistance of 1st section = 2.24 ohm\n",
+ "Resistance of 2nd section = 1.49 ohm\n",
+ "Resistance of 3rd section = 0.99 ohm\n",
+ "Resistance of 4th section = 0.68 ohm\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import log\n",
+ "\n",
+ "# Given\n",
+ "V=500 # V\n",
+ "ns=60 # slots\n",
+ "nc=20 # conductor/slot\n",
+ "ra=1.31 # ohm\n",
+ "Tmax=218 # N-m\n",
+ "fi=23*10**-3 # Wb\n",
+ "\n",
+ "Tmin=Tmax/1.5#N-m\n",
+ "Z=ns*nc # no of conductors\n",
+ "Ia=Tmax/(.159*fi*Z) # A\n",
+ "Imax=1.5*Ia # A\n",
+ "I1=Imax # A\n",
+ "I2=Ia # A\n",
+ "R1=V/I1 # ohm\n",
+ "n= log(R1/ra)/log(I1/I2)+1 # no of studs\n",
+ "N=n-1 # no of section\n",
+ "print \"no of studs = %d and no. of section = %d\"%(n,N)\n",
+ "R2=R1*(I2/I1) # ohm\n",
+ "R3=R2*(I2/I1) # ohm\n",
+ "R4=R3*(I2/I1) # ohm\n",
+ "R1s=R1-R2 # ohm\n",
+ "R2s=R2-R3 # ohm\n",
+ "R3s=R3-R4 # ohm\n",
+ "R4s=R4-ra # ohm\n",
+ "print \"\\nResistance of 1st section = %.2f ohm\"%(R1s)\n",
+ "print \"Resistance of 2nd section = %.2f ohm\"%(R2s)\n",
+ "print \"Resistance of 3rd section = %.2f ohm\"%(R3s)\n",
+ "print \"Resistance of 4th section = %.2f ohm\"%(R4s)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 48 Page 393"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 95,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "temperature rise after 2 hours full load = 55 degree C\n",
+ "temperature rise of cold water after 1 hour = 28 degree C\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import log,exp\n",
+ "\n",
+ "# Given\n",
+ "theta1=20 # degree C\n",
+ "theta2=35 # degree C\n",
+ "t1=0.5 # hour\n",
+ "t2=1 # hour\n",
+ "theta_m_dashBYthetam=80/100 # temperature rise\n",
+ "\n",
+ "#theta=theta_m*(1-e**(-t/alfa))\n",
+ "#theta1/theta2=(1-exp(-t1/alfa))/(1-exp(-t2/alfa))\n",
+ "ee1=theta2/theta1-1 # let ee1=exp(-1/2/alfa)\n",
+ "theta_m=theta1/(1-ee1) # degree C\n",
+ "theta_2=theta_m*(1-ee1**4) # degree C (after 2 hours)\n",
+ "print \"temperature rise after 2 hours full load = %.f degree C\"%(theta_2)\n",
+ "alfa=-1/2/log(ee1) # hour\n",
+ "alfa_dash=theta_m_dashBYthetam*alfa # hour\n",
+ "theta_m_dash=theta_m_dashBYthetam*theta_m\n",
+ "theta_dash=theta_m_dash*(1-exp(-t2/alfa))\n",
+ "print \"temperature rise of cold water after 1 hour = %.f degree C\"%(theta_dash)\n",
+ "#ans of 2nd part is wrong in the book."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 49 Page 394"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 96,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Regulation at no load voltage = 6.7 percent\n",
+ "Regulation at full load voltage = 7.2 percent\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import sqrt,cos,pi,sin\n",
+ "\n",
+ "# Given\n",
+ "u=30 # degree \n",
+ "m=3 # no of phases\n",
+ "\n",
+ "#Id=sqrt(2)*Vs*X*(1-cosd(u))*sin(pi/m)\n",
+ "IdBYVs_dash=m/2/pi*(1-cos(pi/180*u))*sin(pi/m)*sqrt(2) # load current/Vs\n",
+ "#where IdBYVs_dash = m/pi*IdX/2\n",
+ "EdoBYVs=sqrt(2)*m/pi*sin(pi/m) # dc output voltage/Vs with no overlap\n",
+ "EduBYVs=EdoBYVs-IdBYVs_dash # dc output voltage/Vs with overlap\n",
+ "#part (a)\n",
+ "Reg1=(EdoBYVs-EduBYVs)/EdoBYVs*100 # % (regulation)\n",
+ "print \"Regulation at no load voltage = %.1f percent\"%(Reg1)\n",
+ "#part (b)\n",
+ "Reg2=(EdoBYVs-EduBYVs)/EduBYVs*100 # % (regulation)\n",
+ "print \"Regulation at full load voltage = %.1f percent\"%(Reg2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 50 Page 395"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 97,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Current for each machine = 370 A & 1630 A \n",
+ "Power output for each machine = 162.3 kW & 716.3 kW\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from numpy import array\n",
+ "# Given\n",
+ "I12=2000 # A (I12=I1+I2)\n",
+ "R1=0.04 # ohm\n",
+ "R2=0.025 # ohm\n",
+ "rf1=25 # ohm\n",
+ "rf2=20 # ohm\n",
+ "E1=440 # V\n",
+ "E2=420 # V\n",
+ "\n",
+ "#E-Vad=V where Vad=I1+V/rf1\n",
+ "#V*(1+R1/rf1)+R1*I1=E1#eqn(1)\n",
+ "#V*(1+R2/rf2)-I1*R2=E2-I12*R2# eqn(2)\n",
+ "A=array([[(1+R1/rf1),R1],[(1+R2/rf2),-R2]])# # matrix for solution\n",
+ "B=array([[E1],[E2-I12*R2]]) # matrix for solution\n",
+ "X=A**-1*B # solution\n",
+ "V=X[0,0] # V\n",
+ "I1=X[1,0] # A\n",
+ "I2=I12-I1 # A\n",
+ "print \"Current for each machine = %.f A & %.f A \"%(I1,I2)\n",
+ "Po1=V*I1 # W\n",
+ "Po2=V*I2 # W\n",
+ "print \"Power output for each machine = %.1f kW & %.1f kW\"%(Po1/1000,Po2/1000)\n",
+ "#ans in the book are wrong."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 51 Page 396"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 98,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "pf transformer A = 0.82 lag\n",
+ "pf transformer B = 0.78 lag\n",
+ "power output transformer A = 6535 W\n",
+ "power output transformer B = 4925 W\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import atan,pi,cos,degrees\n",
+ "# Given\n",
+ "ZA=0.15+0.5*1J # ohm\n",
+ "ZB=0.1+0.6*1J # ohm\n",
+ "EA=207 # V\n",
+ "EB=205 # V\n",
+ "ZL=2+1.5*1J # ohm\n",
+ "\n",
+ "IA=(EA*ZB+(EA-EB)*ZL)/(ZA*ZB+ZL*(ZA+ZB)) # A\n",
+ "IB=(EB*ZA-(EA-EB)*ZL)/(ZA*ZB+ZL*(ZA+ZB)) # A\n",
+ "V2=(IA+IB)*ZL # V\n",
+ "fi_A=degrees(atan((V2).imag/(V2).real)-(atan((IA.imag)/(IA.real))))\n",
+ "pf_A=cos(pi/180*fi_A) # lag\n",
+ "print \"pf transformer A = %.2f lag\"%(pf_A)\n",
+ "fi_B=degrees(atan((V2.imag)/(V2.real))-(atan((IB.imag)/(IB.real))))\n",
+ "pf_B=cos(pi/180*fi_B) # lag\n",
+ "print \"pf transformer B = %.2f lag\"%(pf_B)\n",
+ "PA=abs(V2*IA*pf_A) # W\n",
+ "print \"power output transformer A = %.f W\"%(PA)\n",
+ "PB=abs(V2*IB*pf_B) # W\n",
+ "print \"power output transformer B = %.f W\"%(PB)\n",
+ "#Power output ans are wrong in the book."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 52 Page 397"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 99,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "filament length = 1.26 m\n",
+ "filament diameter = 20 um\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "# Given\n",
+ "d1=0.05*10**-3 # mm\n",
+ "l1=100*10**-2 # m\n",
+ "i2BYi1=1/4 # current ratio\n",
+ "#(d2/d1)**(3/2)=i2BYi1\n",
+ "d2=(i2BYi1)**(2/3)*d1*10**6 # um\n",
+ "l2=1/2*l1*d1/d2*10**6 # m\n",
+ "print \"filament length = %.2f m\"%(l2)\n",
+ "print \"filament diameter = %.f um\"%(d2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 53 Page 398"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 100,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "filament length = 1.6 m\n",
+ "filament diameter = 48 um\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "# Given\n",
+ "d1=0.10*10**-3 # mm\n",
+ "l1=150*10**-2 # m\n",
+ "i2BYi1=1/3 # current ratio\n",
+ "#(d2/d1)**(3/2)=i2BYi1\n",
+ "d2=(i2BYi1)**(2/3)*d1*10**6 # um\n",
+ "l2=1/2*l1*d1/d2*10**6 # m\n",
+ "print \"filament length = %.1f m\"%(l2)\n",
+ "print \"filament diameter = %.f um\"%(d2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 54 Page 398"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 101,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "(a) at standstill, To:Ti = 8:1\n",
+ "(b) at s=0.05, To:Ti = 3:10\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import sqrt\n",
+ "# Given\n",
+ "zo=2+1J*2 # ohm\n",
+ "zi=0.5+1J*4 # ohm\n",
+ "Ri=(zi).real # ohm\n",
+ "Ro=(zo).real # ohm\n",
+ "\n",
+ "#at standstill\n",
+ "s=1 # % at standstill\n",
+ "Zo=sqrt((zo.real)**2+(zo.imag)**2) # ohm\n",
+ "Zi=sqrt((zi.real)**2+(zi.imag)**2) # ohm\n",
+ "ToBYTi=Ro/Ri*(Zi/Zo)**2 # torque ratio\n",
+ "print \"(a) at standstill, To:Ti = %d:1\"%(ToBYTi)\n",
+ "\n",
+ "#at s=0.5\n",
+ "s=0.05 # %\n",
+ "Zo=sqrt((zo.real)**2/s**2+(zo.imag)**2) # ohm\n",
+ "Zi=sqrt((zi.real)**2/s**2+(zi.imag)**2) # ohm\n",
+ "ToBYTi=Ro/Ri*(Zi/Zo)**2 # torque ratio\n",
+ "print \"(b) at s=0.05, To:Ti = %.f:10\"%(ToBYTi*10)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 55 Page 400"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 102,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "no. of turns in primary = 415\n",
+ "no. of turns in secondary = 12\n",
+ "\n",
+ "cross section of primary winding=6.56e-04 m**2\n",
+ "cross section of secondary winding=1.9e-05 m**2\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import sqrt\n",
+ "\n",
+ "# Given\n",
+ "Edc=250 # V\n",
+ "fim=.065 # Wb\n",
+ "f=50 # Hz\n",
+ "E1=6000 # V\n",
+ "P=1500 # kW\n",
+ "p=8 # pole\n",
+ "pf=0.9\n",
+ "V=400 # V\n",
+ "J=3 # A/mm**2\n",
+ "\n",
+ "E2=Edc/sqrt(2)#V\n",
+ "N2=E2/4.44/f/fim # no. of turns\n",
+ "N1=E1/E2*N2 # no. of turns\n",
+ "print \"no. of turns in primary = %d\"%(N1)\n",
+ "print \"no. of turns in secondary = %d\"%(N2)\n",
+ "Idc=P*10**3/V # A\n",
+ "eta=1 # because of no loss\n",
+ "ISR=0.472*Idc/(eta*pf)\n",
+ "A1=ISR/J*10**-6 # m**2 (cross section area)\n",
+ "I1=N2/N1*ISR # A\n",
+ "A2=I1/J*10**-6 # m**2 (cross section area of primary winding)\n",
+ "print \"\\ncross section of primary winding=%.2e m**2\"%(A1)\n",
+ "print \"cross section of secondary winding=%.1e m**2\"%(A2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 56 Page 400"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 103,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Suitable auto transformation ratio = 86.6\n",
+ "Starting torque Tst = 12 percent of full-load torque\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import sqrt\n",
+ "# Given\n",
+ "IscBYIfl=4 # as Isc=5*Ifl\n",
+ "ILByIfl=3 # as IL <= 3*Ifl\n",
+ "sf=4 # %\n",
+ "\n",
+ "#IL=K**2*ISC\n",
+ "#dividing by Ifl\n",
+ "K=sqrt(ILByIfl/IscBYIfl)*100 # %\n",
+ "TstBYTf=(K/100)**2*IscBYIfl*sf/100*100 # % #ratio of torque\n",
+ "print \"Suitable auto transformation ratio = %.1f\"%(K)\n",
+ "print \"Starting torque Tst = %.f percent of full-load torque\"%(TstBYTf)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 57 Page 401"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 104,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "temperature rise after 2 hours full load = 56 degree C\n",
+ "temperature rise of cold water after 1 hour = 27 degree C\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import log,exp\n",
+ "# Given\n",
+ "theta1=30 # degree C\n",
+ "theta2=45 # degree C\n",
+ "t1=0.5 # hour\n",
+ "t2=1 # hour\n",
+ "theta_m_dashBYthetam=60/100 # temperature rise\n",
+ "\n",
+ "#theta=theta_m*(1-e**(-t/alfa))\n",
+ "#theta1/theta2=(1-exp(-t1/alfa))/(1-exp(-t2/alfa))\n",
+ "ee1=theta2/theta1-1 # let ee1=exp(-1/2/alfa)\n",
+ "theta_m=theta1/(1-ee1) # degree C\n",
+ "theta_2=theta_m*(1-ee1**4) # degree C (after 2 hours)\n",
+ "print \"temperature rise after 2 hours full load = %.f degree C\"%(theta_2)\n",
+ "alfa=-1/2/log(ee1) # hour\n",
+ "alfa_dash=theta_m_dashBYthetam*alfa # hour\n",
+ "theta_m_dash=theta_m_dashBYthetam*theta_m\n",
+ "theta_dash=theta_m_dash*(1-exp(-t2/alfa))\n",
+ "print \"temperature rise of cold water after 1 hour = %.f degree C\"%(theta_dash)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 58 Page 401"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 105,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "at slip=0, To:Ti = 7:1\n",
+ "at s=0.05, To:Ti = 3:10\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import sqrt\n",
+ "# Given\n",
+ "zo=2+1J*3 # ohm\n",
+ "zi=0.5+1J*5 # ohm\n",
+ "Ri=(zi.real) # ohm\n",
+ "Ro=(zo.real) # ohm\n",
+ "\n",
+ "#at standstill\n",
+ "s=1 # % at standstill\n",
+ "Zo=sqrt((zo.real)**2+(zo.imag)**2) # ohm\n",
+ "Zi=sqrt((zi.real)**2+(zi.imag)**2) # ohm\n",
+ "ToBYTi=Ro/Ri*(Zi/Zo)**2 # torque ratio\n",
+ "print \"at slip=0, To:Ti = %d:1\"%(ToBYTi)\n",
+ "\n",
+ "#at s=0.5\n",
+ "s=0.05 # %\n",
+ "Zo=sqrt((zo.real)**2/s**2+(zo.imag)**2) # ohm\n",
+ "Zi=sqrt((zi.real)**2/s**2+(zi.imag)**2) # ohm\n",
+ "ToBYTi=Ro/Ri*(Zi/Zo)**2 # torque ratio\n",
+ "print \"at s=0.05, To:Ti = %.f:10\"%(ToBYTi*10)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 59 Page 402"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 106,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "part(a) Regulation at no load voltage = 15 percent\n",
+ "part(b) Regulation at full load voltage = 17 percent\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import sqrt,pi,sin,cos\n",
+ "\n",
+ "# Given\n",
+ "u=45 # degree \n",
+ "m=3 # no of phases\n",
+ "\n",
+ "#Id=sqrt(2)*Vs*X*(1-cosd(u))*sin(pi/m)\n",
+ "IdBYVs_dash=m/2/pi*(1-cos(pi/180*u))*sin(pi/m)*sqrt(2) # load current/Vs\n",
+ "#where IdBYVs_dash = m/pi*IdX/2\n",
+ "EdoBYVs=sqrt(2)*m/pi*sin(pi/m) # dc output voltage/Vs with no overlap\n",
+ "EduBYVs=EdoBYVs-IdBYVs_dash # dc output voltage/Vs with overlap\n",
+ "#part (a)\n",
+ "Reg1=(EdoBYVs-EduBYVs)/EdoBYVs*100 # % (regulation)\n",
+ "print \"part(a) Regulation at no load voltage = %.f percent\"%(Reg1)\n",
+ "#part (b)\n",
+ "Reg2=(EdoBYVs-EduBYVs)/EduBYVs*100 # % (regulation)\n",
+ "print \"part(b) Regulation at full load voltage = %.f percent\"%(Reg2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 60 Page 402"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 107,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "length of filament = 1.89 m\n",
+ "diameter of filament = 60 um\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "\n",
+ "# Given\n",
+ "d1=0.15*10**-3 # mm\n",
+ "l1=150*10**-2 # m\n",
+ "i2BYi1=1/4 # current ratio\n",
+ "#(d2/d1)**(3/2)=i2BYi1\n",
+ "d2=(i2BYi1)**(2/3)*d1*10**6 # um\n",
+ "l2=1/2*l1*d1/d2*10**6 # m\n",
+ "print \"length of filament = %.2f m\"%(l2)\n",
+ "print \"diameter of filament = %.f um\"%(d2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 61 Page 403"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 108,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Potential difference = 1875 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import sqrt,sin,pi\n",
+ "# Given\n",
+ "d=5/100 # m\n",
+ "S=-4/100 # m\n",
+ "Ve=3 # kV\n",
+ "theta=45 # degree\n",
+ "e=1.6*10**-19 # C\n",
+ "m=9.67*10**-31 # kg\n",
+ "\n",
+ "u=sqrt(2*e*Ve*1000/m) # m/s\n",
+ "uy=u*sin(pi/180*theta) # m/s\n",
+ "vy=0 # since final velocity =0\n",
+ "#vy**2-uy**2=2*ay*S\n",
+ "ay=(vy**2-uy**2)/2/S # m**2/s\n",
+ "#ay=e/m*V/d\n",
+ "V=ay*m*d/e # V\n",
+ "print \"Potential difference = %.f V\"%(V)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex 62 Page 403"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 109,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "reading of ammeter 1= 0.56 A\n",
+ "reading of ammeter 2 = 0.30 A\n",
+ "\n",
+ "\n",
+ "Power taken from the mains = 162.0 W\n",
+ "Power dissipated in rectifying device = 115 W\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "from math import pi\n",
+ "from sympy.mpmath import quad\n",
+ "# Given\n",
+ "R=150 # ohm\n",
+ "Vrms=200 # V\n",
+ "Rd1=65 # ohm\n",
+ "Rd2=140 # ohm \n",
+ "\n",
+ "Vm=Vrms/sqrt(2) # V\n",
+ "#v=Vm*sin(theta)\n",
+ "Rf=R+Rd1 # ohm\n",
+ "Rb=R+Rd2 # ohm\n",
+ "#i_f=v/Rf # A\n",
+ "#i_b=v/Rb # A\n",
+ "Irms=1/2/pi*(quad(lambda theta:(sqrt(2)*sin(theta))**2,[0,pi])+quad(lambda theta:(sqrt(2)/3*sin(theta))**2,[pi,2*pi]))\n",
+ "Iav=1/2/pi*(quad(lambda theta:sqrt(2)*sin(theta),[0,pi])+quad(lambda theta:sqrt(2)/3*sin(theta),[pi,2*pi]))\n",
+ "print \"reading of ammeter 1= %.2f A\"%(Irms)\n",
+ "print \"reading of ammeter 2 = %.2f A\"%(Iav)\n",
+ "P=1/2*(Vrms**2/Rf+Vrms**2/Rb) # W\n",
+ "print \"\\n\\nPower taken from the mains = %.1f W\"%(P)\n",
+ "Pc=Irms**2*R # W\n",
+ "Pd=P-Pc # W\n",
+ "print \"Power dissipated in rectifying device = %d W\"%(Pd)\n",
+ "#Answer wrong in the textbook."
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 2",
+ "language": "python",
+ "name": "python2"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}