diff options
author | Thomas Stephen Lee | 2015-08-28 16:53:23 +0530 |
---|---|---|
committer | Thomas Stephen Lee | 2015-08-28 16:53:23 +0530 |
commit | 4a1f703f1c1808d390ebf80e80659fe161f69fab (patch) | |
tree | 31b43ae8895599f2d13cf19395d84164463615d9 /sample_notebooks/JigneshBhadani/ch5.ipynb | |
parent | 9d260e6fae7328d816a514130b691fbd0e9ef81d (diff) | |
download | Python-Textbook-Companions-4a1f703f1c1808d390ebf80e80659fe161f69fab.tar.gz Python-Textbook-Companions-4a1f703f1c1808d390ebf80e80659fe161f69fab.tar.bz2 Python-Textbook-Companions-4a1f703f1c1808d390ebf80e80659fe161f69fab.zip |
add books
Diffstat (limited to 'sample_notebooks/JigneshBhadani/ch5.ipynb')
-rw-r--r-- | sample_notebooks/JigneshBhadani/ch5.ipynb | 2270 |
1 files changed, 2270 insertions, 0 deletions
diff --git a/sample_notebooks/JigneshBhadani/ch5.ipynb b/sample_notebooks/JigneshBhadani/ch5.ipynb new file mode 100644 index 00000000..189e1172 --- /dev/null +++ b/sample_notebooks/JigneshBhadani/ch5.ipynb @@ -0,0 +1,2270 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f2a55784eb064c2602de5db3699903ee6b51018dcf324e42007dffa21eb1e0ba" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5 : SINGLE PHASE AC CIRCUITS" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.1 Page No : 157" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from numpy import ones\n", + "\n", + "def r2p(x,y):\t\t\t#function to convert recmath.tangular to polar\n", + " polar = ones(2)\n", + " polar[0] = math.sqrt ((x **2) +(y**2))\n", + " polar[1] = math.atan (y/x)\n", + " polar[1] = (polar [1]*180)/math.pi\n", + " return polar\n", + " \n", + "def p2r(r,theta):\t\t\t#function to convert polar to recmath.tangular\n", + " rect = ones(2)\n", + " theta = ( theta *math.pi) /180\n", + " rect [0] = r* math.cos(theta)\n", + " rect [1] = r* math.sin(theta)\n", + " return rect\n", + "\n", + "#CALCULATIONS\n", + "I1 = r2p(7,-5);\n", + "print (I1);\n", + "I2 = r2p(-9,6);\n", + "I2[1] = I2[1]+(180);\t\t\t#this belongs to quadrant 2 and hence 180 degrees should be added\n", + "print (I2);\n", + "I3 = r2p(-8,-8);\n", + "I3[1] = I3[1]+(180);\t\t\t#this belongs to quadrant 3 and hence 180 degrees should be added\n", + "print (I3);\n", + "I4 = r2p(6,6);\n", + "print (I4);\n", + "#note:here direct functions for converson are not available and hence we defined user defined functions for polar to rect and rect to polar conversions\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[ 8.60232527 -45. ]\n", + "[ 10.81665383 135. ]\n", + "[ 11.3137085 225. ]\n", + "[ 8.48528137 45. ]\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.2 Page No : 157" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from numpy import ones\n", + "\n", + "def r2p(x,y):\t\t\t#function to convert recmath.tangular to polar\n", + " polar = ones(2)\n", + " polar[0] = math.sqrt ((x **2) +(y**2))\n", + " polar[1] = math.atan (y/x)\n", + " polar[1] = (polar [1]*180)/math.pi\n", + " return polar\n", + " \n", + "def p2r(r,theta):\t\t\t#function to convert polar to recmath.tangular\n", + " rect = ones(2)\n", + " theta = ( theta *math.pi) /180\n", + " rect [0] = r* math.cos(theta)\n", + " rect [1] = r* math.sin(theta)\n", + " return rect\n", + " \n", + "#CALCULATIONS\n", + "#for subdivision 1\n", + "I1 = p2r(10,60);\n", + "I2 = p2r(8,-45);\n", + "I3 = I1+I2;\n", + "print (I3);\n", + "I4 = r2p(I3[0],I3[1]);\n", + "print (I4)\n", + "#for subdivision 2\n", + "I5 = r2p(5,4);\n", + "I6 = r2p(-4,-6);\n", + "I7 = ones(2)\n", + "I7[0] = (I5[0])*(I6[0]);\n", + "I7[1] = (I5[1]+I6[1]);\n", + "I7[1] = I7[1]-180;\n", + "print (I7);\n", + "#for subdivision 3\n", + "I8 = r2p(-2,-5);\n", + "I9 = r2p(5,7);\n", + "I10 = ones(2)\n", + "I10[0] = I8[0]/I9[0];\n", + "I10[1] = I8[1]-I9[1];\n", + "I10[1] = I10[1]-180\n", + "print (I10);\n", + "#note:here direct functions for converson are not available and hence we defined user defined functions for polar to rect and rect to polar conversions\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[ 10.65685425 3.00339979]\n", + "[ 11.07198956 15.73932193]\n", + "[ 46.17358552 -135. ]\n", + "[ 0.62601269 -161.56505118]\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.3 Page No : 160" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#given i(t) = 5*math.sin(314*t+(2*math.pi/3))&& v(t) = 20*math.sin(314*t+(5*math.pi/6))\n", + "#CALCULATIONS\n", + "P1 = 2*(math.pi/3);\t\t\t#phase angle of current in radians\n", + "P1 = P1*(180/math.pi);\t\t\t#phase angle of current in degrees\n", + "P2 = 5*(math.pi/6);\t\t\t#phase angle of voltage in radians\n", + "P2 = P2*(180/math.pi);\t\t\t#phase angle of voltage in degrees\n", + "P3 = P2-P1;\t\t\t#current lags voltage by P3 degrees\n", + "P4 = P3*math.pi/180;\n", + "pf = math.cos(P4);\t\t\t#lagging pf\n", + "Vm = 20;\t\t\t#peak voltage\n", + "Im = 5;\t\t\t#peak current\n", + "Z = Vm/Im;\t\t\t#impedance in ohms\n", + "R = (Z)*math.cos(P4);\t\t\t#resistance in ohms\n", + "Xl = math.sqrt((Z)**2-(R)**2);\t\t\t#reacmath.tance \n", + "W = 314;\n", + "L = Xl/W;\t\t\t#inductance in henry\n", + "V = Vm/math.sqrt(2);\t\t\t#average value of voltage\n", + "I = Im/math.sqrt(2);\t\t\t#average value of current\n", + "av = (V*I)*math.cos(P4);\t\t\t#average power in watts\n", + "print \"thus impedance, resistance, inductance, powerfactor and average power are %d ohms, %1.2f ohms, %g H,%1.3f and %2.1f W respectively\"%(Z,R,L,pf,av);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "thus impedance, resistance, inductance, powerfactor and average power are 4 ohms, 3.46 ohms, 0.00636943 H,0.866 and 43.3 W respectively\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.4 Page No : 161" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "#Chapter-5, Example 5.4, Page 161\n", + "\n", + "#INPUT DATA\n", + "I = 10.;\t\t\t#given current in A\n", + "P = 1000.;\t\t\t#power in Watts\n", + "V = 250.;\t\t\t#voltage in volts\n", + "f = 25.;\t\t\t#frequency in Hz\n", + "\n", + "#CALCULATIONS\n", + "R = P/((I)**2);\t\t\t#resistance in ohms\n", + "Z = V/I;\t\t\t#impedance in ohms\n", + "Xl = math.sqrt((Z)**2-(R)**2);\t\t\t#reacmath.tance in ohms\n", + "L = Xl/(2*math.pi*f);\t\t\t#inductance in Henry\n", + "Pf = R/Z;\t\t\t#power factor,lagging,pf = math.cos(phi)\n", + "\n", + "# Results\n", + "print \"thus impedance, resistance, inductance, reactance and powerfactor are %d ohms, %d ohms, %1.3f H, \\\n", + "%2.2f ohms and %1.1f respectively\"%(Z,R,L,Xl,Pf);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "thus impedance, resistance, inductance, reactance and powerfactor are 25 ohms, 10 ohms, 0.146 H, 22.91 ohms and 0.4 respectively\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.5 Page No : 162" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "#Chapter-5, Example 5.5, Page 162\n", + "\n", + "#INPUT DATA\n", + "V = 250.;\t\t\t#supply voltage in volts\n", + "f = 50.;\t\t\t#frequency in hz\n", + "Vr = 125.;\t\t\t#voltage across resistance in volts\n", + "Vc = 200.;\t\t\t#voltage across coil in volts\n", + "I = 5.;\t\t\t#current in A\n", + "#CALCULATIONS\n", + "R = Vr/I;\t\t\t#resistance in ohms\n", + "Z1 = Vc/I;\t\t\t#impedance of coil in ohms\n", + "#Z1 = math.sqrt((R1)**2+(Xl)**2)------eqn(1)\n", + "Z = V/I;\t\t\t#total impedance in ohms\n", + "#Z = math.sqrt((R+R1)**2+(Xl)**2)-----eqn(2)\n", + "#solving eqn(1)and eqn(2) we get R1 as follows\n", + "R1 = (((Z)**2-(Z1)**2)-(R)**2)/(2*R);\t\t\t#in ohms\n", + "Xl = math.sqrt((Z1)**2-(R1)**2);\t\t\t#reacmath.tance of coil in ohms\n", + "P = ((I)**2*R1);\t\t\t#power absorbed by the coil in Watts\n", + "Pt = ((I)**2)*(R+R1);\t\t\t#total power in Watts\n", + "\n", + "# Results\n", + "print \"thus impedance, resistance, reactance are %d ohms, %d ohms, %2.2f ohms respectively\"%(Z1,R,Xl);\n", + "print \"power absorbed and total power are %3.1f W and %3.1f W respectively\"%(P,Pt)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "thus impedance, resistance, reactance are 40 ohms, 25 ohms, 39.62 ohms respectively\n", + "power absorbed and total power are 137.5 W and 762.5 W respectively\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.6 Page No : 163" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "#Chapter-5, Example 5.6, Page 163\n", + "\n", + "#INPUT DATA\n", + "V = 240;\t\t\t#supply voltage in volts\n", + "Vl = 171;\t\t\t#voltage across inductor in volts\n", + "I = 3;\t\t\t#current in A\n", + "phi = 37;\t\t\t#power factor laggging in degrees\n", + "#CALCULATIONS\n", + "Zl = Vl/I;\t\t\t#impedance of coil in ohms\n", + "#Zl = math.sqrt((R1)**2+(Xl)**2)------eqn(1)\n", + "Z = V/I;\t\t\t#total impedance in ohms\n", + "#Z = math.sqrt((R+R1)**2+(Xl)**2)-----eqn(2)\n", + "pf = math.cos(phi*math.pi/180);\t\t\t#powerfactor\n", + "Rt = pf*Z;\t\t\t#total resistance in ohms\t\t\t#Rt = (R+R1)\n", + "#substituting Rt value in eqn(2) we find Xl as follows\n", + "Xl = math.sqrt((Z)**2-(Rt)**2);\t\t\t#reacmath.tance of inductor in ohms\n", + "#ubstituting Xl value in eqn(1) we find R1 as follows\n", + "R1 = math.sqrt((Zl)**2-(Xl)**2);\t\t\t#resistance of inductor in ohms\n", + "R = Rt-R1;\t\t\t#resistance of resistor in ohms\n", + "print \"Thus resistance of resistor is %2.2f ohms\"%(R);\n", + "print \"Thus resisimath.tance and reacmath.tance of inductor are %2.2f ohms and %2.2f ohms respectively\"%(R1,Xl)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus resistance of resistor is 33.38 ohms\n", + "Thus resisimath.tance and reacmath.tance of inductor are 30.51 ohms and 48.15 ohms respectively\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.7 Page No : 164" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "#Chapter-5, Example 5.7, Page 164\n", + "\n", + "#INPUT DATA\n", + "V = 100;\t\t\t#supply voltage in volts\n", + "#for COIL A\n", + "f = 50;\t\t\t#frequency in Hz\n", + "I1 = 8;\t\t\t#current in A\n", + "P1 = 120;\t\t\t#power in Watts\n", + "#for COIL B\n", + "I2 = 10;\t\t\t#current in A\n", + "P2 = 500;\t\t\t#power in Watts\n", + "#CALCULATIONS\n", + "#FOR COIL A\n", + "Z1 = V/I1;\t\t\t#impedance of coil A in ohms\n", + "R1 = P1/(I1)**2;\t\t\t#resistance of coil A in ohms\n", + "X1 = math.sqrt(((Z1)**2-(R1)**2));\t\t\t#reacmath.tance of coil A in ohms\n", + "#FOR COIL B\n", + "Z2 = V/I2;\t\t\t#impedance of coil B in ohms\n", + "R2 = P2/(I2)**2;\t\t\t#resistance of coil B in ohms\n", + "X2 = math.sqrt(((Z2)**2-(R2)**2));\t\t\t#reacmath.tance of coil B in ohms\n", + "#When both COILS A and B are in series\n", + "Rt = R1+R2;\t\t\t#total resistance in ohms\n", + "Xt = X1+X2;\t\t\t#total reacmath.tance in ohms\n", + "Zt = math.sqrt((Rt)**2+(Xt)**2);\t\t\t#total impedance in ohms\n", + "It = V/Zt;\t\t\t#current drawn in A\n", + "P = ((It)**2)*(Rt);\t\t\t#power taken in watts\n", + "print \"Thus current drawn and power taken in watts are %2.2f A and %3.2f W respectively\"%(It,P);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus current drawn and power taken in watts are 4.66 A and 130.12 W respectively\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.8 Page No : 167" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "#Chapter-5, Example 5.8, Page 167\n", + "\n", + "#INPUT DATA\n", + "R = 100;\t\t\t#resistance in ohms\n", + "C = 50*10**-6;\t\t\t#capacitance in F\n", + "V = 200;\t\t\t#voltage in Volts\n", + "f = 50;\t\t\t#frequency in Hz\n", + "#Z = R-(1j)*(Xc)------>impedance\n", + "Xc = 1/(2*math.pi*f*C);\t\t\t#capacitive reacmath.tance in ohms\n", + "Z = math.sqrt((R)**2+(Xc)**2);\t\t\t#impedance in ohms\n", + "I = V/Z;\t\t\t#current in A\n", + "pf = R/Z;\t\t\t#power factor ------>math.cos(phi)---->leading\n", + "phi = math.acos(0.844);\t\t\t#phase angle in radians\n", + "phi = phi*180/math.pi;\t\t\t#phase angle in degrees\n", + "Vr = (I)*(R);\t\t\t#voltage across resistor\n", + "Vc = (I)*(Xc);\t\t\t#votage across capacitor\n", + "print \"Thus impedance, current, powerfactor and phaseangle are %3.2f ohms, %1.2f A, %1.3f and %2.2f degrees respectively\"%(Z,I,pf,phi);\n", + "print \"voltage across resistor and capacitor are %d V and %3.2f V respectively\"%(Vr,Vc)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus impedance, current, powerfactor and phaseangle are 118.54 ohms, 1.69 A, 0.844 and 32.44 degrees respectively\n", + "voltage across resistor and capacitor are 168 V and 107.41 V respectively\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.9 Page No : 169" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "#Chapter-5, Example 5.9, Page 169\n", + "\n", + "#INPUT DATA\n", + "phi = 40;\t\t\t#phase in degrees\n", + "V = 150;\t\t\t#voltage in Volts\n", + "I = 8;\t\t\t#current in A\n", + "#the applied voltage lags behind the current .That means the current leads the voltage\n", + "#hence pf is leading\n", + "#CALCULATIONS\n", + "pf = math.cos(phi*math.pi/180);\t\t\t#in degrees--->leading\n", + "#hence it is a capacitive circuit\n", + "pa = V*I*pf;\t\t\t#active power in W\n", + "pr = V*I*math.sin(phi*math.pi/180);\t\t\t#reactive power in VAR\n", + "print \"Thus active and reactive power are %3.1f W and %3.1f VAR respectively\"%(pa,pr);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus active and reactive power are 919.3 W and 771.3 VAR respectively\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.10 Page No : 169" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "#Chapter-5, Example 5.10, Page 169\n", + "\n", + "#INPUT DATA\n", + "#given v = 141.4*math.sin(314*t)\n", + "P = 700.;\t\t\t#power in Watts\n", + "pf = 0.707;\t\t\t#powerfactor------>leading------>math.cos(phi)\n", + "Vm = 141.4;\t\t\t#maximum value of supply voltage\n", + "#CALCULATIONS\n", + "Vr = Vm/(math.sqrt(2));\t\t\t#rms value of supply voltage\n", + "I = P/(Vr*pf);\t\t\t#current in A\n", + "Z = Vr/I;\t\t\t#impedance in ohms\n", + "R = (Z)*(pf);\t\t\t#resistance in ohms\n", + "phi = math.acos(pf)*180/math.pi;\t\t\t#angle in degrees\n", + "Xc = (Z)*(math.sin(phi));\t\t\t#reacmath.tance in ohms\n", + "C = 1/(3.14*7.13);\t\t\t#capacitance in F\n", + "print \"Thus resistance and capacitance are %1.2f ohms and %g F respectively\"%(R,C);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus resistance and capacitance are 7.14 ohms and 0.0446664 F respectively\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.11 Page No : 169" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "#Chapter-5, Example 5.11, Page 169\n", + "\n", + "#INPUT DATA\n", + "V = 200.;\t\t\t#supply voltage in volts\n", + "f = 50.;\t\t\t#freq in hz\n", + "P = 7000.;\t\t\t#power in Watts\n", + "Vr = 130.;\t\t\t#volatge across resistor in volts\n", + "P = 7000.;\t\t\t#power in Watts\n", + "\n", + "#CALCULATIONS\n", + "R = ((Vr)**2)/P;\t\t\t#resistance in ohms\n", + "I = Vr/R;\t\t\t#current in A\n", + "Z = V/I;\t\t\t#total impedance in ohms\n", + "Xc = math.sqrt((Z)**2-(R)**2);\n", + "C = 1/(2*math.pi*f*Xc);\t\t\t#capacitance in F\n", + "pf = R/Z;\t\t\t#power factor------>leading\n", + "phi = math.acos(pf);\t\t\t#angle in radians\n", + "phi = phi*180/math.pi;\t\t\t#angle in degrees\n", + "Vm = V*math.sqrt(2);\t\t\t#maximum value of voltage\n", + "#voltage equation v = Vm*math.sin(2*math.pi*f*t)------>282.84*math.sin(314.16*t)\n", + "#current leads voltage by phi\n", + "#current equation ------>i = 76.155*math.sin(314.16*t+phi)\n", + "print \"Thus current, resistance, p.f, capacitance, impedance are %2.2f A , %1.2f ohms, %2.1f , \\\n", + "%g F and %1.2f ohms respectively\"%(I,R,pf,C,Z);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus current, resistance, p.f, capacitance, impedance are 53.85 A , 2.41 ohms, 0.6 , 0.00112771 F and 3.71 ohms respectively\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.12 Page No : 170" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "C = 50.;\t\t\t#capacitance in uf\n", + "R = 100.;\t\t\t#resistance in ohms\n", + "V = 200.;\t\t\t#supply voltage in volts\n", + "f = 50.;\t\t\t#freq in hz\n", + "#CALCULATIONS\n", + "Xc = 1/(2*math.pi*f*C*10**-6);\t\t\t#capacitive reacmath.tance in ohms\n", + "Z = R-((1j)*Xc);\t\t\t#impedance in ohms\n", + "print (Z);\n", + "z1 = math.sqrt((R)**2+(Xc)**2);\n", + "theta = math.atan(Xc/R);\n", + "pf = math.cos(theta);\t\t\t#powerfactor\n", + "I = V/z1;\t\t\t#current in A\n", + "P = V*I*pf;\t\t\t#power in Watts\n", + "print \"Thus current, power factor, power are % 1.2f A ,%1.3f ,%d W respectively\"%(I,pf,P);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(100-63.6619772368j)\n", + "Thus current, power factor, power are 1.69 A ,0.844 ,284 W respectively\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.13 Page No : 170" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "C = 0.05;\t\t\t#capacitance in uf\n", + "F = 500;\t\t\t#freq in hz\n", + "#CALCULATIONS\n", + "Xl = 1/(2*math.pi*F*C*10**-6);\t\t\t#capacitive reacmath.tance in ohms\n", + "#at resonance Xl = Xc \n", + "L = (Xl/(2*math.pi*F));\t\t\t#inductance in H\n", + "print \"Thus value of L is %1.2f H\"%(L);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus value of L is 2.03 H\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.14 Page No : 171" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "V = 200;\t\t\t#voltage in V\n", + "R = 50;\t\t\t#resistance in ohms\n", + "L = 0.5;\t\t\t#inductance in Henry\n", + "F = 50;\t\t\t#freq in hz\n", + "#CALCULATIONS\n", + "Xl = 2*math.pi*F*L;\t\t\t#inductive reacmath.tance\n", + "Z = (R)+((1j)*Xl)\t\t\t#impedance\n", + "print (Z);\n", + "z1 = math.sqrt((R)**2+(Xl)**2);\t\t\t#magnitude\n", + "theta = math.atan(Xl/R);\t\t\t#angle in radians\n", + "I = V/z1;\t\t\t#current in A\n", + "P = V*I*math.cos(theta);\t\t\t#power supplied in W\n", + "#here capacitive reacmath.tance equals inductive reacmath.tance\n", + "#hence Xc = Xl\n", + "C = 1/(2*math.pi*F*Xl);\t\t\t#capacitance in uf\n", + "r = (V/I)-(R);\t\t\t#additional resistance to be added in series\n", + "print \"Thus current and power required are % 1.2f A and %2.2f W respectively\"%(I,P);\n", + "print \"Thus additional resistance that neede to be connected in series with R and C to have\\\n", + " same current at unity power factor is %1.1f ohms\"%(r);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(50+157.079632679j)\n", + "Thus current and power required are 1.21 A and 73.60 W respectively\n", + "Thus additional resistance that neede to be connected in series with R and C to have same current at unity power factor is 114.8 ohms\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.15 Page No : 171" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "R = 50.;\t\t\t#resistance in ohms\n", + "L = 9.;\t\t\t#inductance in Henry\n", + "I0 = 1.;\t\t\t#current in A\n", + "f = 75.;\t\t\t#ferquency in Hz\n", + "#at resonance Xl = Xc \n", + "#CALCULATIONS\n", + "Xl = 2*math.pi*f*L;\t\t\t#inductive reacmath.tance\n", + "Xc = Xl;\t\t\t#capacitive reacmath.tance\n", + "C = 1/(2*math.pi*f*Xc);\t\t\t#capacitance in uf\n", + "print \"Thus capacitance is %g F\"%(C);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus capacitance is 5.00352e-07 F\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.16 Page No : 175" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "R = 10.;\t\t\t#resistance in ohms\n", + "L = 0.1;\t\t\t#inductance in Henry\n", + "C = 150.;\t\t\t#capacitor in uf\n", + "V = 200.;\t\t\t#voltage in V\n", + "f = 50.;\t\t\t#frequency in hz\n", + "#CALCULATIONS\n", + "Xc = 1/(2*math.pi*f*C*10**-6);\t\t\t#Capacitive reacmath.tance in ohms\n", + "Xl = (2*math.pi*f*L);\t\t\t#inductive reacmath.tance in ohms\n", + "Z = R+((1j)*(Xl-Xc));\t\t\t#impedance in ohms\n", + "z1 = math.sqrt((R)**2+(Xl-Xc)**2);\t\t\t#magnitude of Z\n", + "I = V/z1;\t\t\t#current in A\n", + "pf = R/z1;\t\t\t#power factor----->math.cos(phi)\n", + "#As Xl-Xc is inductive,pf is lagging\n", + "z2 = math.sqrt((R**2)+(Xl)**2);\t\t\t#impedance of coil in ohms\n", + "Vl = I*(z2);\t\t\t#voltage across coil in volts\n", + "Vc = I*(Xc);\t\t\t#voltage across capacitor in volts\n", + "print \"Thus inductive reacmath.tance, capacitive reacmath.tance, impedance, current, powerfactor are %2.2f ohms, \\\n", + "%2.2f ohms, %2.2f ohms, %d A, %1.1f respectively\"%(Xl,Xc,z1,I,pf);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus inductive reacmath.tance, capacitive reacmath.tance, impedance, current, powerfactor are 31.42 ohms, 21.22 ohms, 14.28 ohms, 14 A, 0.7 respectively\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.17 Page No : 176" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "L = 10;\t\t\t#inductance in milliHenry\n", + "C = 5;\t\t\t#capacitor in uf\n", + "phi = 50;\t\t\t#phase in degrees-------->lagging\n", + "f = 500;\t\t\t#frequency in hz\n", + "V = 200;\t\t\t#supply voltage in volts\n", + "\n", + "#CALCULATIONS\n", + "Xc = 1/(2*math.pi*f*C*10**-6);\t\t\t#Capacitive reacmath.tance in ohms\n", + "Xl = (2*math.pi*f*L*10**-3);\t\t\t#inductive reacmath.tance in ohms\n", + "R = (Xc-Xl)/(math.tan(phi*math.pi/180));\t\t\t#resistance in ohms\n", + "Z = math.sqrt((R)**2+(Xc-Xl)**2);\t\t\t#impedance in ohms\n", + "I = V/Z;\t\t\t#current in A\n", + "Vr = (I)*(R);\t\t\t#voltage across resistance\n", + "Vl = (I)*(Xl);\t\t\t#voltage across inductance\n", + "Vc = (I)*(Xc);\t\t\t#voltage across capacitance\n", + "print \"Thus voltages across resistance, inductance, capacitance are %3.2f volts, %3.2f volts, %3.2f volts respectively\"%(Vr,Vl,Vc);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus voltages across resistance, inductance, capacitance are 128.56 volts, 149.26 volts, 302.47 volts respectively\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.18 Page No : 176" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from sympy import Symbol,solve\n", + "#Chapter-5, Example 5.18, Page 176\n", + "\n", + "#INPUT DATA\n", + "L = 5;\t\t\t#inductance in Henry\n", + "f = 50;\t\t\t#frequency in hz\n", + "V = 230;\t\t\t#supply voltage in volts\n", + "R = 2;\t\t\t#resistance in ohms\n", + "V1 = 250;\t\t\t#voltage across coil in V\n", + "\n", + "#CALCULATIONS\n", + "Xl = (2*math.pi*f*L);\t\t\t#inductive reacmath.tance in ohms\n", + "Z1 = math.sqrt((R)**2+(Xl)**2);\t\t\t#impedance of coil in ohms\n", + "I = V1/Z1;\t\t\t#current in A\n", + "Z = V/I;\t\t\t#total impedance in ohms\n", + "#Z = math.sqrt((R)**2+(Xl-Xc)**2) and solving for Xc\n", + "Xc = Symbol(\"Xc\");\n", + "p = (Xc**2)-3141.58*(Xc)+378004\n", + "roots2 = solve(p);\n", + "r2 = roots2[1];\n", + "#Xc cannot be greater than Z\n", + "C = 1/(2*math.pi*f*r2);\t\t\t#capacitance in F\n", + "print \"Thus value of C that must be present suct that voltage across coil is 250 volts is %g F respectively\"%(C);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus value of C that must be present suct that voltage across coil is 250 volts is 1.05531e-06 F respectively\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.19 Page No : 178" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "#Chapter-5, Example 5.19, Page 178\n", + "\n", + "#v = 350*math.cos(3000*t-20)\n", + "#i = 15*math.cos(3000*t-60)\n", + "#INPUT DATA\n", + "L = 0.5;\t\t\t#inductance in Henry\n", + "phi = -40;\t\t\t#phase difference between applied voltage and current\n", + "#Xl>Xc(P.f is lagging)\n", + "w = 3000;\t\t\t#freq in hz\n", + "Vm = 350;\t\t\t#peak voltage in volts\n", + "Im = 15;\t\t\t#peak current in amps\n", + "#CALCULATIONS\n", + "Z = Vm/Im;\t\t\t#total impedance in ohms\n", + "#Xl-Xc = 0.839*R = X\n", + "#Z = math.sqrt((R)**2+(X)**2)\n", + "#Z = 1.305*R\n", + "R = Z/1.305;\t\t\t#resistance in ohms\n", + "X = 0.839*R;\t\t\t#\n", + "#X = Xl-Xc\n", + "Xl = w*L;\t\t\t#reactive inductance in ohms\n", + "Xc = Xl-X;\t\t\t#capacitive reacmath.tance in ohms\n", + "C = 1/(w*Xc);\t\t\t#capacitance in uf\n", + "print \"Thus resistance and capacitance are %2.2f ohms and %g F respectively\"%(R,C);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus resistance and capacitance are 17.62 ohms and 2.24435e-07 F respectively\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.20 Page No : 182" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from numpy.linalg import inv\n", + "from scipy.optimize import fsolve\n", + "from sympy.solvers import solve\n", + "\n", + "\n", + "#INPUT DATA\n", + "R = 10;\t\t\t#resistance in ohms\n", + "L = 0.1;\t\t\t#inductance in henry\n", + "f = 50;\t\t\t#frequency in hz\n", + "#CALCULATIONS\n", + "Xl = (2*math.pi*f*L);\t\t\t#inductive reacmath.tance in ohms\n", + "Z = R+((1j)*(Xl));\t\t\t#impedance in ohms\n", + "Y = inv([[Z]])#[0];\t\t\t#admittance in mho\n", + "y = abs(Y);\t\t\t#admittance in mho\n", + "print \"admittance is %1.5f mho\"%(y);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "admittance is 0.03033 mho\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.21 Page No : 182" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from numpy.linalg import inv\n", + "\n", + "#INPUT DATA\n", + "#CALCULATIONS\n", + "Z = 10+((1j)*(5));\t\t\t#impedance in ohms\n", + "Y = inv([[Z]]);\t\t\t#admittance in mho\n", + "print (Y);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[[ 0.08-0.04j]]\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.22 Page No : 182" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "Z1 = 7.+((1j)*5);\t\t\t#impedance of branch1 in ohms\n", + "Z2 = 10.-((1j)*8);\t\t\t#impedance of branch2 in ohms\n", + "V = 230.;\t\t\t#supply voltage in volts\n", + "f = 50.;\t\t\t#frequency in hz\n", + "#CALCULATIONS\n", + "Y1 = 1/(Z1);\t\t\t#admittance of branch1 in mho\n", + "Y2 = 1/(Z2);\t\t\t#admittance of branch2 in mho\n", + "Y = Y1+Y2;\t\t\t#admittance of combined circuit\n", + "print (Y);\n", + "g = abs(Y);\t\t\t#conductance in mho;\n", + "B = math.atan(Y.imag/Y.real);\t\t\t#susceptance in mho\n", + "I = V*(Y);\t\t\t#current\n", + "print (I);\t\t\t#total current taken from mains in A\n", + "z = math.atan(I.imag/I.real);\n", + "pf = math.cos(z);\t\t\t#power factor\n", + "print \"thus conductance and susceptance of the circuit is %1.3f mho and %1.3f mho respectively\"%(g,B);\n", + "print \"power factor is %1.3f lagging\"%(pf)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(0.155570204351-0.0187870797627j)\n", + "(35.7811470007-4.32102834542j)\n", + "thus conductance and susceptance of the circuit is 0.157 mho and -0.120 mho respectively\n", + "power factor is 0.993 lagging\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.23 Page No : 183" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "#Chapter-5, Example 5.23, Page 183\n", + "\n", + "#INPUT DATA\n", + "V = 240.;\t\t\t#voltage in volts\n", + "f = 50.;\t\t\t#frequency in Hz\n", + "R = 15.;\t\t\t#resisimath.tance in ohms\n", + "I = 22.1;\t\t\t#current in A\n", + "#CALCULATIONS\n", + "G = 1/R;\t\t\t#conductance in mho\n", + "#susceptance of the circuit,B = 1/(Xl) = 0.00318/L\n", + "#admittance of the circuit,(G-jB) = (0.067-j(0.00318/L))\n", + "Y = I/V;\t\t\t#admittance in mho;\n", + "#Y = math.sqrt((0.067)**2+(0.00318/L)**2) = 0.092-----eqn(1)\n", + "#solving eqn(1) for L we have it as\n", + "L = math.sqrt((0.00318)**2/((Y)**2-(G)**2));\t\t\t#inductance in henry\n", + "#when current is 34A\n", + "I1 = 34;\t\t\t#current in A\n", + "Y1 = I1/V;\t\t\t#admittance in mho\n", + "#for Y1 we need to find f \n", + "f1 = math.sqrt((3.183)**2/((Y1)**2-(G)**2));\t\t\t#frequency in hz\n", + "print \"Thus value of frequency when current is 34A is %2.1f Hz\"%(f1);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus value of frequency when current is 34A is 25.5 Hz\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.24 Page No : 184" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from numpy.linalg import inv\n", + "\n", + "#Chapter-5, Example 5.24, Page 184\n", + "\n", + "#INPUT DATA\n", + "L = 0.05;\t\t\t#inductance in henry\n", + "R2 = 20.;\t\t\t#resistance in ohms\n", + "R1 = 15.;\t\t\t#resistance in ohms\n", + "V = 200.;\t\t\t#supply voltage in volts\n", + "f = 50.;\t\t\t#frequency in hz\n", + "#CALCULATIONS\n", + "#for branch 1\n", + "Z1 = (R1)+((1j)*(2*math.pi*f*L));\t\t\t#impedance in ohms\n", + "Y1 = inv([[Z1]]);\t\t\t#admittance in branch\n", + "I1 = V*(Y1);\t\t\t#current in branch\n", + "print (I1);\n", + "i1 = abs(I1);\t\t\t#magnitude of current\n", + "#for branch 2\n", + "Y2 = 1/R2;\t\t\t#admittance in branch\n", + "I2 = V*Y2;\t\t\t#current in branch\n", + "i2 = abs(I2);\t\t\t#magnitude of current\n", + "I = I1+I2;\t\t\t#total current in A\n", + "i = abs(I);\t\t\t#magnitude of total current\n", + "theta = math.atan(I.imag/I.real);\t\t\t#angle in radians\n", + "theta = theta*(180)/(math.pi);\t\t\t#angle in degrees\n", + "print \"Thus current in branch1,branch2 abd total currents are %1.2f A, %d A, %2.2f A respectively\"%(i1,i2,i);\n", + "print \"phase angle of the combination is %2.1f degrees\"%(theta);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[[ 6.3594338-6.6595835j]]\n", + "Thus current in branch1,branch2 abd total currents are 9.21 A, 10 A, 17.66 A respectively\n", + "phase angle of the combination is -22.2 degrees\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.25 Page No : 185" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from numpy.linalg import inv\n", + "\n", + "#INPUT DATA\n", + "L = 6.;\t\t\t#inductance in millihenry\n", + "R2 = 50.;\t\t\t#resistance in ohms\n", + "R1 = 40.;\t\t\t#resistance in ohms\n", + "C = 4.;\t\t\t#capacitance in uf\n", + "V = 100.;\t\t\t#voltage in volts\n", + "f = 800.;\t\t\t#frequency in hz\n", + "#CALCULATIONS\n", + "Xl = (2*math.pi*f*L*10**-3);\t\t\t#inductive reacmath.tance in ohms\n", + "Xc = 1/(2*math.pi*f*C*10**-6);\t\t\t#capacitive reacmath.tance in ohms\n", + "Y1 = inv([[(R1)+(1j*Xl)]]);\t\t\t#admittance of branch1 in mho\n", + "Y2 = inv([[(R2)-(1j*Xc)]]);\t\t\t#admittance of branch2 in mho\n", + "I1 = V*(Y1);\t\t\t#current in branch 1\n", + "I2 = V*(Y2);\t\t\t#current in branch 2\n", + "I = I1+I2;\t\t\t#total curremt in A\n", + "theta = (math.atan(I1.imag/I1.real))-math.atan(I2.imag/I2.real);\n", + "theta = theta*180/math.pi;\t\t\t#angle in degrees\n", + "print \"Thus total current taken from supply is %2.2f\"%(abs(I));\n", + "print \"phase angle between currents of coil and capacitor is %2.2f degrees\"%(theta);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus total current taken from supply is 2.61\n", + "phase angle between currents of coil and capacitor is -81.86 degrees\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.26 Page No : 186" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "Z1 = 10+(1j*15);\t\t\t#impedance in ohms\n", + "Z2 = 6-(1j*8);\t\t\t#impedance in ohms\n", + "I = 15.;\t\t\t#current in A\n", + "#CALCULATIONS\n", + "I1 = ((Z2)/(Z1+Z2))*(I);\t\t\t#umath.sing current division rule\n", + "I2 = ((Z1)/(Z1+Z2))*(I);\t\t\t#umath.sing current division rule\n", + "i1 = abs(I1);\t\t\t#magnitude of current 1\n", + "i2 = abs(I2);\t\t\t#magnitdude of current 2\n", + "P1 = ((i1)**2)*(Z1*(1));\t\t\t#power consumed by branch 1\n", + "P2 = ((i2)**2)*(Z2*(1));\t\t\t#power consumed by branch 2\n", + "print \"Thus power consumed by branches 1 and 2 are %3.2f W and %4.1f W respectively\"%(P1.real,P2.real);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus power consumed by branches 1 and 2 are 737.70 W and 1438.5 W respectively\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.27 Page No : 187" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from numpy.linalg import inv\n", + "#Chapter-5, Example 5.27, Page 187\n", + "\n", + "#INPUT DATA\n", + "V = 200.;\t\t\t#voltage in volts\n", + "f = 50.;\t\t\t#frequency in hz\n", + "R1 = 10.;\t\t\t#resistance in ohms\n", + "L1 = 0.0023;\t\t\t#inductance in henry\n", + "R2 = 5.;\t\t\t#resistance in ohms\n", + "L2 = 0.035;\t\t\t#inductance in henry\n", + "#CALCULATIONS\n", + "Xl1 = (2*math.pi*f*L1);\t\t\t#inductive reacmath.tance in branch 1 in ohm\n", + "Xl2 = (2*math.pi*f*L2);\t\t\t#inductive reacmath.tance in branch 2 in ohm\n", + "Y1 = inv([[10+(1j*7.23)]]);\t\t\t#admittance of branch 1 in mho\n", + "Y2 = inv([[5+(1j*10.99)]]);\t\t\t#admittance of branch 2 in mho\n", + "Y = Y1+Y2;\t\t\t#total admittance in mho\n", + "I1 = V*(Y1);\t\t\t#current through branch1\n", + "I2 = V*(Y2);\t\t\t#current through branch2\n", + "I = I1+I2;\t\t\t#total current in A\n", + "theta = math.atan(I.imag/I.real);\t\t\t#angle in radians\n", + "pf_of_combination = math.cos(theta);\t\t\t#powerfactor---->lagging\n", + "print \"Thus currents in branch1, branch2 and total current are %2.1f A, %2.1f A and %2.2f A respectively\"%(abs(I1),abs(I2),abs(I));\n", + "print \"pf of combination is %1.3f\"%(pf_of_combination);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus currents in branch1, branch2 and total current are 16.2 A, 16.6 A and 31.68 A respectively\n", + "pf of combination is 0.631\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.28 Page No : 189" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "f = 50.;\t\t\t#freq in hz\n", + "V = 100.;\t\t\t#volatge in V\n", + "L1 = 0.015;\t\t\t#inductance in branch 1 in henry\n", + "L2 = 0.08;\t\t\t#inductance in branch 2 in henry\n", + "R1 = 2.;\t\t\t#resistance of branch 1 in ohms\n", + "x1 = 4.71;\t\t\t#reacmath.tance of branch 1 in ohms\n", + "R2 = 1.;\t\t\t#resistance of branch 2 in ohms\n", + "x2 = 25.13;\t\t\t#reacmath.tance of branch 2 in ohms\n", + "Z1 = (R1)+(1j*x1);\t\t\t#impedance of branch1 in ohms\n", + "Z2 = (R2)+(1j*x2);\t\t\t#impedance of branch1 in ohms\n", + "I1 = V/Z1;\t\t\t#current in branch 1 in A\n", + "print \"current in branch 1 in A\"\n", + "print (I1);\n", + "I2 = V/Z2;\t\t\t#current in branch 2 in A\n", + "print \"current in branch 2 in A\"\n", + "print (I2);\n", + "I3 = I1+I2;\t\t\t#total current in A\n", + "print \"total current in A\"\n", + "print (I3);\n", + "#note:Answer for real part of total current given in textbook is wrong.Please check the calculations\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "current in branch 1 in A\n", + "(7.63822319652-17.9880156278j)\n", + "current in branch 2 in A\n", + "(0.158098542505-3.97301637316j)\n", + "total current in A\n", + "(7.79632173903-21.961032001j)\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.29 Page No : 189" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from numpy.linalg import inv\n", + "\n", + "#CALCULATIONS\n", + "R = 8;\t\t\t#resistance in ohms\n", + "Xc = -(1j)*12;\t\t\t#capacitive reacmath.tance in ohms\n", + "Y = (inv([[R]])+inv([[Xc]]));\t\t\t#admittance in mho\n", + "print (Y);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[[ 0.125+0.08333333j]]\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.30 Page No : 189" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from numpy.linalg import inv\n", + "\n", + "#CALCULATIONS\n", + "R = 3;\t\t\t#resistance in ohms\n", + "Xl = (1j)*4;\t\t\t#inductive reacmath.tance in ohms\n", + "Y = (inv([[R]])+inv([[Xl]]));\t\t\t#admittance in mho\n", + "print (Y);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[[ 0.33333333-0.25j]]\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.31 Page No : 196" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "R = 10.;\t\t\t#resistance in ohms\n", + "L = 10.;\t\t\t#inductance in milli henry\n", + "C = 1.;\t\t\t#capacitance in uF\n", + "V = 200.;\t\t\t#applied voltage in volts\n", + "\n", + "#CALCULATIONS\n", + "fr = 1/(2*math.pi*(math.sqrt(L*C*10**-3*10**-6)));\t\t\t#resonant frequency in hz\n", + "I0 = V/(R);\t\t\t#current at resonance in A\n", + "Vr = I0*R;\t\t\t#voltage across resistance in volts\n", + "Xl = 2*math.pi*fr*L*10**-3;\t\t\t#inductance in ohms\n", + "Vl = I0*Xl;\t\t\t#voltage across inductor in volts\n", + "Xc = inv([[2*math.pi*fr*C*10**-6]]);\t\t\t#capacitance in ohms\n", + "Vc = I0*Xc;\t\t\t#voltage across capacitor in volts\n", + "wr = 2*math.pi*fr\t\t\t#angular resonant frewuency in rad/sec\n", + "Q = (wr*L*10**-3)/(R);\t\t\t#quality factor\n", + "Bw = (fr/Q);\t\t\t#bandwidth in hz\n", + "print \"Thus resonant frequency and current are %4.2f hz and %d A respectively\"%(fr,I0);\n", + "print \"voltages across resistance, inductance and capacitance are %d V, %d V and %d V respectively\"%(Vr,Vl,Vc);\n", + "print \"bandwidth and quality factor are %3.2f hz and %d respectively\"%(Bw,Q);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus resonant frequency and current are 1591.55 hz and 20 A respectively\n", + "voltages across resistance, inductance and capacitance are 200 V, 2000 V and 2000 V respectively\n", + "bandwidth and quality factor are 159.15 hz and 10 respectively\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.32 Page No : 196" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from numpy.linalg import inv\n", + "#Chapter-5, Example 5.32, Page 196\n", + "\n", + "#INPUT DATA\n", + "V = 220.;\t\t\t#applied voltage in volts\n", + "f = 50.;\t\t\t#frequency in hz\n", + "Imax = 0.4;\t\t\t#maximum current in A\n", + "Vc = 330.;\t\t\t#voltage across capacitance in volts\n", + "#at resonance condition I0 = 0.4 A\n", + "I0 = 0.4\t\t\t#current in A\n", + "#CALCULATIONS\n", + "Xc = (Vc)/(I0);\t\t\t#capacitive reacmath.tance in ohms\n", + "C = inv([[2*math.pi*f*Xc]]);\t\t\t#capacitance in F\n", + "#at resonance condition Xc = Xl, hence\n", + "L = Xc/(2*math.pi*f);\t\t\t#inductance in henry\n", + "R = V/(Imax);\t\t\t#resistance in ohms\n", + "print \"Thus resistance, inductance and capacitance are %d ohms, %1.2f H and %g F respectively\"%(R,L,C);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus resistance, inductance and capacitance are 550 ohms, 2.63 H and 3.8583e-06 F respectively\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.33 Page No : 197" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "R1 = 5;\t\t\t#resistance of branch1 in ohms\n", + "R2 = 2;\t\t\t#resistance of branch2 in ohms\n", + "L = 10;\t\t\t#inductance in mH\n", + "C = 40;\t\t\t#capacitance in uF \n", + "#CALCULATIONS\n", + "fr = (1./(2*math.pi*(math.sqrt(L*C*10**-9))))*(math.sqrt(((C*10**-6*(R1)**2)-L*10**-3)/((C*10**-6*(R2)**2)-L*10**-3)));\t\t\t#resonant frequency in hz\n", + "print \"Thus resonant frequency is %f hz\"%(fr);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus resonant frequency is 240.665502 hz\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.34 Page No : 197" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "R = 20;\t\t\t#resistance in ohms\n", + "L = 0.2;\t\t\t#inductance in H\n", + "C = 100;\t\t\t#capacitance in uF \n", + "#resistance will be non-inductive only at reosnant frequency\n", + "#CALCULATIONS\n", + "fr = (1./(2*math.pi*(math.sqrt(L*C*10**-6))))*(math.sqrt((L-(C*10**-6*(R)**2))/(L)));\t\t\t#resonant frequency in hz\n", + "print \"Thus resonant frequency is %2.2f hz\"%(fr);\n", + "Rf = (L)/(C*R*10**-6);\t\t\t#non-inductive resistance\n", + "print \"Thus value of non-inductive resistance is %d ohms\"%(Rf);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus resonant frequency is 31.83 hz\n", + "Thus value of non-inductive resistance is 100 ohms\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.35 Page No : 198" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#INPUT DATA\n", + "Q = 250;\t\t\t#quality factor\n", + "fr = 1.5*10**6;\t\t\t#resonant freq in hertz\n", + "\n", + "#CALCULATIONS\n", + "Bw = (fr)/(Q);\t\t\t#bandwidth in Hz\n", + "hf1 = fr+Bw;\t\t\t#half power freq 1\n", + "hf2 = fr-Bw;\t\t\t#half power freq 2\n", + "print \"Thus bandwidth is %d hz\"%(Bw);\n", + "print \"Thus value of half-power frequencies are %g hz and %g hz\"%(hf1,hf2);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus bandwidth is 6000 hz\n", + "Thus value of half-power frequencies are 1.506e+06 hz and 1.494e+06 hz\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.36 Page No : 198" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "L = 40*10**-3;\t\t\t#inductance in henry\n", + "C = 0.01*10**-6;\t\t\t#capacitance in uf\n", + "#CALCULATIONS\n", + "fr = 1./(2*math.pi*math.sqrt(L*C));\t\t\t#resonant frequency\n", + "print \"Thus resonant frequency is %d hz\"%(fr);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus resonant frequency is 7957 hz\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.37 Page No : 198" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from numpy.linalg import inv\n", + "#Chapter-5, Example 5.37, Page 198\n", + "\n", + "#INPUT DATA\n", + "V = 120.;\t\t\t#source voltage in volts\n", + "R = 50.;\t\t\t#resistance in ohms\n", + "L = 0.5;\t\t\t#inductance in Henry\n", + "C = 50.;\t\t\t#capacitance in uF\n", + "\n", + "#CALCULATIONS\n", + "#at Resonance\n", + "fr = (1./(2*math.pi*(math.sqrt(L*C*10**-6))));\t\t\t#resonant frequency in hz\n", + "I0 = V/R;\t\t\t#current at resonance in A\n", + "Vl = (1j)*(I0*L);\t\t\t#voltage developed across inductor in volts\n", + "Vc = (-1j)*(I0*L);\t\t\t#voltage developed across capacitor in volts\n", + "Q = (inv([[R]]))*(math.sqrt(L/(C*10**-6)));\t\t\t#quality factor\n", + "Bw = (fr)/(Q);\t\t\t#Bandwidth in Hz\n", + "#given resonance is to occur at 300 rad/sec,then\n", + "wr = 300;\t\t\t#wr = (2*math.pi*f*r)------->measured in Hz\n", + "#wr = inv(math.sqrt(L*Cn))\n", + "Cr = inv([[L*(wr)**2]]);\t\t\t#capacitance required in uF\n", + "print \"Thus resonant frequency, current, quality factor and bandwidth are %2.1f Hz, \\\n", + "%1.1f A, %d and %2.1f hz respectively\"%(fr,I0,Q,Bw);\n", + "print \"New value of capacitance at 300 rad/sec is %g F\"%(Cr)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus resonant frequency, current, quality factor and bandwidth are 31.8 Hz, 2.4 A, 2 and 15.9 hz respectively\n", + "New value of capacitance at 300 rad/sec is 2.22222e-05 F\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.38 Page No : 199" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "#INPUT DATA\n", + "Q = 45.;\t\t\t#quality factor\n", + "f1 = 600.*10**3;\t\t\t#freq in Hz\n", + "f2 = 1000.*10**3;\t\t\t#freq in Hz\n", + "#given new resistance is 50% greater than former.let us consider two reismath.tances as R1 = 1 ohm and R2 = 1.5 ohm for ease of calculation.Then\n", + "R1 = 1;\t\t\t#resistance in ohm\n", + "R2 = 1.5;\t\t\t#resistance in ohm\n", + "\n", + "#CALCULATIONS\n", + "W1 = 2*math.pi*f1;\t\t\t#angular freq 1 in rad/sec\n", + "W2 = 2*math.pi*f2;\t\t\t#angular freq 2 in rad/sec\n", + "Q = 45;\t\t\t#quality factor\n", + "L = (Q*R1)/(W1);\t\t\t#inductance in henry\n", + "Q1 = (W2*L)/(R2);\t\t\t#new quality factor\n", + "print \"Thus new quality factor is %d\"%(Q1);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus new quality factor is 50\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.39 Page No : 199" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from numpy.linalg import inv\n", + "\n", + "#INPUT DATA\n", + "R = 4.;\t\t\t#resistance in ohm\n", + "L = 100.*10**-6;\t\t\t#inductance in henry\n", + "C = 250.*10**-12;\t\t\t#capacitance in Farads\n", + "\n", + "#CALCULATIONS\n", + "fr = inv([[2*math.pi*math.sqrt(L*C)]]);\t\t\t#resonant frequency in Hz\n", + "Q = (inv([[R]]))*(math.sqrt(L/C));\t\t\t#Q-factor\n", + "Bw = fr/Q;\t\t\t#bandwidth in Hz\n", + "hf1 = fr+Bw;\t\t\t#halfpower freq1 in Hz\n", + "hf2 = fr-Bw;\t\t\t#halfpower freq2 in Hz\n", + "\n", + "print \"Thus resonant freq, Q-factor and new halfpower frequencies are %d hz , %d, %g hz, %g hz respectively\"%(fr,Q,hf1,hf2);\n", + "#note:given answers are wrong in textbook.Please check the answers\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus resonant freq, Q-factor and new halfpower frequencies are 1006584 hz , 158, 1.01295e+06 hz, 1.00022e+06 hz respectively\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.40 Page No : 200" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from numpy.linalg import inv\n", + "\n", + "#INPUT DATA\n", + "R = 10;\t\t\t#resistance in ohm\n", + "L = 10**-3;\t\t\t#inductance in henry\n", + "C = 1000*10**-12;\t\t\t#capacitance in Farads\n", + "V = 20;\t\t\t#voltage in volts\n", + "#CALCULATIONS\n", + "fr = inv([[2*math.pi*math.sqrt(L*C)]]);\t\t\t#resonant frequency in Hz\n", + "Q = (inv([[R]]))*(math.sqrt(L/C));\t\t\t#Q-factor\n", + "Bw = fr/Q;\t\t\t#bandwidth in Hz\n", + "hf1 = fr+Bw;\t\t\t#halfpower freq1 in Hz\n", + "hf2 = fr-Bw;\t\t\t#halfpower freq2 in Hz\n", + "print \"Thus resonant freq, Q-factor and new halfpower frequencies are %d hz , %d , %g hz, %g hz respectively\"%(fr,Q,hf1,hf2);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus resonant freq, Q-factor and new halfpower frequencies are 159154 hz , 100 , 160746 hz, 157563 hz respectively\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.41 Page No : 208" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "P1 = 1000.;\t\t\t#power1 in watts\n", + "P2 = 1000.;\t\t\t#power2 in watts\n", + "#CALCULATIONS\n", + "#for case(1)\n", + "Pt = P1+P2;\t\t\t#total power in watts\n", + "phi = math.atan(math.sqrt(3)*((P2-P1)/(P2+P1))*(180/math.pi));\t\t\t#math.since math.tan(phi) = math.sqrt(3)*((P2-P1)/(P2+P1)))\n", + "pf = math.cos(phi);\n", + "print \"Thus power and powerfactor are %d W ,%d respectively\"%(Pt,pf);\n", + "#for case(2)\n", + "P3 = 1000;\t\t\t#power3 in watts\n", + "P4 = -1000;\t\t\t#power4 in watts\n", + "Pt1 = P3+P4;\t\t\t#total power in watts\n", + "pf1 = 0;\t\t\t#math.since we cannot perform division by zero in scilab,it doesn't consider it as infinite quantity to yield 90 degree angle and hence powerfactor 0\n", + "print \"Thus power and powerfactor are %d W ,%d respectively\"%(Pt1,pf1);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus power and powerfactor are 2000 W ,1 respectively\n", + "Thus power and powerfactor are 0 W ,0 respectively\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.42 Page No : 209" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "V1 = 400.;\t\t\t#voltage in volts\n", + "Z1 = (3.+((1j)*4));\t\t\t#impedance in ohms\n", + "#CALCULATIONS\n", + "#in star connected system,phase voltage = (line voltage)\n", + "Ep = V1/(math.sqrt(3));\t\t\t#voltage in volts\n", + "Ip = Ep/Z1;\t\t\t#current in A\n", + "ip1 = abs(Ip);\t\t\t#line current in A\n", + "theta = math.atan(Ip.imag/Ip.real);\n", + "Pt = math.sqrt(3)*V1*ip1*math.cos(theta);\t\t\t#total power consumed in load in W\n", + "print \"Thus total power consumed in load is %f W\"%(Pt);\n", + "#note:for line current the answer given is 46.02A instead of 46.2 A and hence total power consumed changes\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus total power consumed in load is 19200.000000 W\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.43 Page No : 209" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#INPUT DATA\n", + "V1 = 400;\t\t\t#voltage in volts\n", + "Il = 10;\t\t\t#current in A\n", + "#CALCULATIONS\n", + "#in star connected system,phase current = (line current) = I1\n", + "phase_voltage = (V1)/(math.sqrt(3));\t\t\t#voltage in Volts\n", + "print \"Thus phase voltage is %1.0f V\"%(phase_voltage);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus phase voltage is 231 V\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.44 Page No : 209" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "#Chapter-5, Example 5.44, Page 209\n", + "\n", + "#INPUT DATA\n", + "Z1 = (6-((1j)*8));\t\t\t#impedance1 in ohms\n", + "Z2 = (16+((1j)*12));\t\t\t#impedance2 in ohms\n", + "I1 = (12+((1j)*16));\t\t\t#current in A\n", + "#CALCULATIONS\n", + "V = I1*Z1;\t\t\t#applied voltage in volts\n", + "I2 = V/(Z2);\t\t\t#current in other branch in A\n", + "print \"current in other branch in Amps\"\n", + "print (I2);\n", + "I = I1+I2;\t\t\t#total current in A\n", + "print \"total current in Amps\";\n", + "print (I);\n", + "i1 = abs(I);\t\t\t#magnitude in A\n", + "i2 = math.atan(I.imag/I.real);\n", + "P = V*i1*math.cos(i2);\t\t\t#power consumed in circuit\n", + "print \"Thus voltage applied and power consumed are %d V and %d W respectively\"%(V.real,P.real);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "current in other branch in Amps\n", + "(8-6j)\n", + "total current in Amps\n", + "(20+10j)\n", + "Thus voltage applied and power consumed are 200 V and 4000 W respectively\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.45 Page No : 210" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "Vl = 415.;\t\t\t#voltage in volts\n", + "Z = (4+((1j)*6));\t\t\t#impedance in each phase in ohm\n", + "#CALCULATIONS\n", + "Ip = Vl/Z;\t\t\t#current in each phase in A\n", + "ip1 = abs(Ip);\t\t\t#magnitude of Ip\n", + "Il = (math.sqrt(3))*(ip1);\t\t\t#line current in A\n", + "phi = math.atan(Ip.imag/Ip.real)\n", + "P = (math.sqrt(3))*Vl*Il*math.cos(phi);\t\t\t#power supplied in W\n", + "print \"Thus power supplied is %d W\"%(P);\n", + "#note:the math.cosfunction of scilab and calculator will differ slightly\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus power supplied is 39744 W\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.46 Page No : 210" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#INPUT DATA\n", + "Vl = 400;\t\t\t#voltage in volts\n", + "Il = 20;\t\t\t#current in A\n", + "f = 50;\t\t\t#freq in hz\n", + "pf = 0.3\t\t\t#power factor\n", + "#CALCULATIONS\n", + "Ip = Il/math.sqrt(3);\t\t\t#phase current in A\n", + "Z = Vl/Ip;\t\t\t#impedance in each phase in ohms\n", + "phi = math.acos(0.3);\t\t\t#angle in radians\n", + "Zb = Z*(math.cos(phi)+(1j)*math.sin(phi));\t\t\t#impedance connected in each phase\n", + "print \"Thus impedance connected in each phase in ohms\";\n", + "print (Zb);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus impedance connected in each phase in ohms\n", + "(10.3923048454+33.0454232837j)\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.47 Page No : 210" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "P1 = 6*10**3;\t\t\t#power in Kw\n", + "P2 = -1*10**3;\t\t\t#power in Kw\n", + "#CALCULATIONS\n", + "P = P1+P2;\t\t\t#total power in Kw\n", + "a = math.atan(math.sqrt(3)*((P2-P1)/(P2+P1)));\n", + "pf = math.cos(a);\t\t\t#power factor\n", + "print \"Thus power and power factor are %d W and %1.2f respectively\"%(P,pf);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus power and power factor are 5000 W and 0.28 respectively\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.48 Page No : 211" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "Z = 3-((1j)*4);\t\t\t#impedance in ohms\n", + "Vl = 400;\t\t\t#line voltage in volts\n", + "#CALCULATIONS\n", + "Vp = Vl/(math.sqrt(3));\t\t\t#phase voltage in volts\n", + "Ip = Vp/abs(Z);\t\t\t#phase current in Amps\n", + "#line current(Il) = phase current(Ip)\n", + "Il = Ip;\t\t\t#line current in A\n", + "power_factor = math.cos(math.atan(Z.imag/Z.real));\n", + "power_consumed = math.sqrt(3)*Vl*Il*power_factor;\n", + "print \"Thus power consumed and power factor are %f W and %1.1f respectively\"%(power_consumed,power_factor);\n", + "#note:answer computed for power consumed in textbook is wrong.Please check the calculations\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus power consumed and power factor are 19200.000000 W and 0.6 respectively\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.49 Page No : 211" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "Il = 10.;\t\t\t#current in Amps\n", + "Vl = 400.;\t\t\t#line voltage in volts\n", + "#CALCULATIONS\n", + "Vp = Vl/(math.sqrt(3));\t\t\t#line to neutral voltage\n", + "Ip = Il;\t\t\t#phase current in Amps\n", + "print \"Thus line to neutral voltage and phase current are %1.0f V and %d A respectively\"%(Vp,Ip);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus line to neutral voltage and phase current are 231 V and 10 A respectively\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.50 Page No : 211" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "#INPUT DATA\n", + "P1 = 2000;\t\t\t#power in watts\n", + "P2 = 1000;\t\t\t#power in watts\n", + "Vl = 400;\t\t\t#line voltage in volts\n", + "#CALCULATIONS\n", + "P = P1+P2;\t\t\t#power in Watts\n", + "a = math.sqrt(3*(P1-P2)/(P1+P2));\n", + "b = math.atan(math.sqrt(a));\n", + "power_factor = math.cos(b);\n", + "kVA = P/power_factor;\n", + "print \"Thus power, power factor and kVA are %d W , %1.3f and %1.2f respectively\"%(P,power_factor,kVA);\n", + "#note:computed value for powerfactor and kVA in textbook are wrong.Please check the calculations" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus power, power factor and kVA are 3000 W , 0.707 and 4242.64 respectively\n" + ] + } + ], + "prompt_number": 26 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file |