diff options
author | hardythe1 | 2014-07-25 13:33:31 +0530 |
---|---|---|
committer | hardythe1 | 2014-07-25 13:33:31 +0530 |
commit | 1c1ea29e3e213559fef5f928df109b7d17c21f24 (patch) | |
tree | a1d38eb039e19d9e84b6e769cec04d59e7179e66 /Electrical_Circuit_Theory_And_Technology/chapter_24.ipynb | |
parent | efb9ead5d9758d5d0bed7a22069320b14f972e40 (diff) | |
download | Python-Textbook-Companions-1c1ea29e3e213559fef5f928df109b7d17c21f24.tar.gz Python-Textbook-Companions-1c1ea29e3e213559fef5f928df109b7d17c21f24.tar.bz2 Python-Textbook-Companions-1c1ea29e3e213559fef5f928df109b7d17c21f24.zip |
removing unwanted and adding book
Diffstat (limited to 'Electrical_Circuit_Theory_And_Technology/chapter_24.ipynb')
-rw-r--r-- | Electrical_Circuit_Theory_And_Technology/chapter_24.ipynb | 837 |
1 files changed, 837 insertions, 0 deletions
diff --git a/Electrical_Circuit_Theory_And_Technology/chapter_24.ipynb b/Electrical_Circuit_Theory_And_Technology/chapter_24.ipynb new file mode 100644 index 00000000..8160e132 --- /dev/null +++ b/Electrical_Circuit_Theory_And_Technology/chapter_24.ipynb @@ -0,0 +1,837 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:829d21461d0ddb81a1efda36f24f3a06a46515329e5239b342aaa3633230388b"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 24: Application of complex numbers to series a.c. circuits</h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 1, page no. 433</h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "import cmath\n",
+ "#initializing the variables:\n",
+ "z1 = 12 + 5j;\n",
+ "z2 = -40j;\n",
+ "r3 = 30;\n",
+ "theta3 = 60;# in degrees\n",
+ "r4 = 2.20E6; \n",
+ "theta4 = -30;# in degrees\n",
+ "f = 50;# in Hz\n",
+ "\n",
+ "#calculation:\n",
+ " #for an R-L series circuit, impedance\n",
+ " # Z = R + iXL\n",
+ "Ra = z1.real\n",
+ "XLa = z1.imag\n",
+ "La = XLa/(2*math.pi*f)\n",
+ " #for a purely capacitive circuit, impedance Z = -iXc\n",
+ "Xcb = abs(z2.imag)\n",
+ "Cb = 1/(2*math.pi*f*Xcb)\n",
+ "z3 = r3*cmath.cos(theta3*math.pi/180) + (r3*cmath.sin(theta3*math.pi/180))*1j\n",
+ "Rc = z3.real\n",
+ "XLc = z3.imag\n",
+ "Lc = XLc/(2*math.pi*f)\n",
+ "z4 = r4*cmath.cos(theta4*math.pi/180) + (r4*cmath.sin(theta4*math.pi/180))*1j\n",
+ "Rd = z4.real\n",
+ "Xcd = abs(z4.imag)\n",
+ "Cd = 1/(2*math.pi*f*Xcd)\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "print \"\\n\\n Result \\n\\n\"\n",
+ "print \"\\n (a)an impedance (12 + i5)ohm represents a resistance of \",round( Ra,2),\" ohm \"\n",
+ "print \"in series with an inductance of \",round(La*1000,2),\"mH\"\n",
+ "print \"\\n (b)an impedance -40i ohm represents a pure capacitor of capacitance \",round(Cb*1E6,2),\"uF\"\n",
+ "print \"\\n (c)an impedance 30/_60deg ohm represents a resistance of \",round(Rc,2),\" ohm \"\n",
+ "print \"in series with an inductance of \",round(Lc*1000,2),\"mH\"\n",
+ "print \"\\n (d)an impedance 2.20 x 10^6 /_-30deg ohm represents a resistance of \",round(Rd/1000,2),\"kohm \"\n",
+ "print \" in series with a capacitor of capacitance \",round(Cd*1E9,2),\"nF\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ " Result \n",
+ "\n",
+ "\n",
+ "\n",
+ " (a)an impedance (12 + i5)ohm represents a resistance of 12.0 ohm \n",
+ "in series with an inductance of 15.92 mH\n",
+ "\n",
+ " (b)an impedance -40i ohm represents a pure capacitor of capacitance 79.58 uF\n",
+ "\n",
+ " (c)an impedance 30/_60deg ohm represents a resistance of 15.0 ohm \n",
+ "in series with an inductance of 82.7 mH\n",
+ "\n",
+ " (d)an impedance 2.20 x 10^6 /_-30deg ohm represents a resistance of 1905.26 kohm \n",
+ " in series with a capacitor of capacitance 2.89 nF\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 2, page no. 434</h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "import cmath\n",
+ "#initializing the variables:\n",
+ "L = 0.1592 ;# in Henry\n",
+ "V = 250;# in Volts\n",
+ "f = 50;# in Hz\n",
+ "R = 0;# in ohms\n",
+ "\n",
+ "#calculation:\n",
+ " #for an R\u00e2\u20ac\u201cL series circuit, impedance\n",
+ " # Z = R + iXL\n",
+ "XL = 2*math.pi*f*L\n",
+ "Z = R + 1j*XL\n",
+ "I = V/Z\n",
+ "x = I.real\n",
+ "y = I.imag\n",
+ "r = (x**2 + y**2)**0.5\n",
+ "if ((x==0)&(y<0)):\n",
+ " theta = -90\n",
+ "elif ((x==0)&(y>0)):\n",
+ " theta = +90\n",
+ "else:\n",
+ " theta = cmath.phase(complex(x,y))*180/math.pi\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "print \"\\n\\n Result \\n\\n\"\n",
+ "print \"\\n current is (\",round(r,2),\"/_\",theta,\"deg) A\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ " Result \n",
+ "\n",
+ "\n",
+ "\n",
+ " current is ( 5.0 /_ -90 deg) A"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 3, page no. 435</h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "import cmath\n",
+ "#initializing the variables:\n",
+ "C = 3E-6 ;# in farad\n",
+ "f = 1000;# in Hz\n",
+ "ri = 2.83;\n",
+ "thetai = 90;# in degrees\n",
+ "\n",
+ "#calculation:\n",
+ " #Capacitive reactance Xc\n",
+ "Xc = 1/(2*math.pi*f*C)\n",
+ " # circuit impedance Z\n",
+ "Z = -1*1j*Xc\n",
+ "I = ri*math.cos(thetai*math.pi/180) + 1j*ri*math.sin(thetai*math.pi/180)\n",
+ "V = I*Z\n",
+ "x = V.real\n",
+ "y = V.imag\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "print \"\\n\\n Result \\n\\n\"\n",
+ "print \"\\n supply p.d. is \",round(abs(V),0),\"V\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ " Result \n",
+ "\n",
+ "\n",
+ "\n",
+ " supply p.d. is 150.0 V"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 4, page no. 435</h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "import cmath\n",
+ "#initializing the variables:\n",
+ "V = 240;# in Volts\n",
+ "f = 50;# in Hz\n",
+ "Z = 30 - 50j;\n",
+ "\n",
+ "#calculation:\n",
+ " #Since impedance Z = 30 - i50,\n",
+ " #resistance\n",
+ "R = Z.real\n",
+ " #capacitive reactance\n",
+ "Xc = abs(Z.imag)\n",
+ " #capacitance\n",
+ "C = 1/(2*math.pi*f*Xc)\n",
+ " #modulus of impedance\n",
+ "modZ = (R**2 + Xc**2)**0.5\n",
+ "I = V/Z\n",
+ "x = I.real\n",
+ "y = I.imag\n",
+ "r = (x**2 + y**2)**0.5\n",
+ "theta = cmath.phase(complex(x,y))*180/math.pi\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "print \"\\n\\n Result \\n\\n\"\n",
+ "print \"\\n (a)resistance is \",round( R,2),\" ohm\"\n",
+ "print \"\\n (b)capacitance is \",round(C*1E6,2),\"uFarad\"\n",
+ "print \"\\n (c)modulus of impedance is \",round(modZ,2),\" ohm\"\n",
+ "print \"\\n (d)current flowing and its phase angle is (\",round( r,2),\"/_\",round( theta,2),\"deg) A\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ " Result \n",
+ "\n",
+ "\n",
+ "\n",
+ " (a)resistance is 30.0 ohm\n",
+ "\n",
+ " (b)capacitance is 63.66 uFarad\n",
+ "\n",
+ " (c)modulus of impedance is 58.31 ohm\n",
+ "\n",
+ " (d)current flowing and its phase angle is ( 4.12 /_ 59.04 deg) A"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 5, page no. 436</h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "import cmath\n",
+ "#initializing the variables:\n",
+ "V = 200;# in Volts\n",
+ "f = 50;# in Hz\n",
+ "R = 32;# in ohms\n",
+ "L = 0.15;# in Henry\n",
+ "\n",
+ "#calculation:\n",
+ " #Inductive reactance XL\n",
+ "XL = 2*math.pi*f*L\n",
+ " #impedance, Z\n",
+ "Z = R + 1j*XL\n",
+ " #Current I\n",
+ "I = V/Z\n",
+ "xi = I.real\n",
+ "yi = I.imag\n",
+ "ri = (xi**2 + yi**2)**0.5\n",
+ "if ((xi==0)&(yi<0)):\n",
+ " thetai = -90\n",
+ "elif ((xi==0)&(yi>0)):\n",
+ " thetai = +90\n",
+ "else:\n",
+ " thetai = cmath.phase(complex(xi,yi))*180/math.pi\n",
+ "\n",
+ " #P.d. across the resistor\n",
+ "VR = I*R\n",
+ "xr = VR.real\n",
+ "yr = VR.imag\n",
+ "rr = (xr**2 + yr**2)**0.5\n",
+ "thetar = cmath.phase(complex(xr,yr))*180/math.pi\n",
+ " #P.d. across the coil, VL\n",
+ "VL = I*1j*XL\n",
+ "xl = VL.real\n",
+ "yl = VL.imag\n",
+ "rl = (xl**2 + yl**2)**0.5\n",
+ "thetal = cmath.phase(complex(xl,yl))*180/math.pi\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "print \"\\n\\n Result \\n\\n\"\n",
+ "print \"\\n (a)impedance is \",round(Z.real,2),\" + \",round( Z.imag,2),\")i ohm\"\n",
+ "print \"\\n (b)current flowing and its phase angle is lagging the voltage = (\",round( ri,2),\"/_\",round( thetai,2),\"deg) A\"\n",
+ "print \"\\n (c)P.d. across the resistor is (\",round(rr,2),\"/_\",round(thetar,2),\"deg) V\"\n",
+ "print \"\\n (d)P.d. across the coil, VL is (\",round(rl,2),\"/_\",round(thetal,2),\"deg) V\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ " Result \n",
+ "\n",
+ "\n",
+ "\n",
+ " (a)impedance is 32.0 + 47.12 )i ohm\n",
+ "\n",
+ " (b)current flowing and its phase angle is lagging the voltage = ( 3.51 /_ -55.82 deg) A\n",
+ "\n",
+ " (c)P.d. across the resistor is ( 112.36 /_ -55.82 deg) V\n",
+ "\n",
+ " (d)P.d. across the coil, VL is ( 165.46 /_ 34.18 deg) V"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 6, page no. 436</h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "#initializing the variables:\n",
+ "V = 120 + 200j;# in Volts\n",
+ "f = 5E6;# in Hz\n",
+ "I = 7 + 16j;# in amperes\n",
+ "\n",
+ "#calculation:\n",
+ " #impedance, Z\n",
+ "Z = V/I\n",
+ "R = Z.real\n",
+ "X = Z.imag \n",
+ "if ((R>0)&(X<0)):\n",
+ " C = -1/(2*math.pi*f*X)\n",
+ "#Results\n",
+ " print \"\\n\\n Result \\n\\n\"\n",
+ " print \"\\n The series circuit thus consists of a resistor of resistance \",round(R,2),\" ohm \"\n",
+ " print \"and a capacitor of capacitive reactance\", round(X*-1,3),\"ohm and capacitance is\",round(C*1E9,2),\" nFarad\\n\"\n",
+ "elif ((R>0)&(X>0)):\n",
+ " L = 2*math.pi*f*X\n",
+ "#Results\n",
+ " print \"\\n\\n Result \\n\\n\"\n",
+ " print \"\\n The series circuit thus consists of a resistor of resistance \",round(R,2),\" ohm \"\n",
+ " print \" and a inductor of insuctance \",round(L*100,2),\" mHenry\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ " Result \n",
+ "\n",
+ "\n",
+ "\n",
+ " The series circuit thus consists of a resistor of resistance 13.25 ohm \n",
+ "and a capacitor of capacitive reactance 1.705 ohm and capacitance is 18.67 nFarad\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 7, page no. 437</h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "import cmath\n",
+ "#initializing the variables:\n",
+ "rv = 70;# in volts\n",
+ "thetav = 30;# in degrees\n",
+ "ri = 3.5;# in amperes\n",
+ "thetai = -20;# in degrees\n",
+ " #z1 consist of two resistance\n",
+ "R1 = 4.36;# in ohms\n",
+ "R2 = -2.1j;# in ohms\n",
+ "\n",
+ " #calculation:\n",
+ "V = rv*math.cos(thetav*math.pi/180) + 1j*rv*math.sin(thetav*math.pi/180)\n",
+ "I = ri*math.cos(thetai*math.pi/180) + 1j*ri*math.sin(thetai*math.pi/180)\n",
+ " #impedance, Z\n",
+ "Z = V/I\n",
+ " #Total impedance Z = z1 + z2\n",
+ "Z1 = R1 + R2\n",
+ "Z2 = Z - Z1\n",
+ "x = Z2.real\n",
+ "y = Z2.imag \n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "print \"\\n\\n Result \\n\\n\"\n",
+ "print \"\\n impedance Z2 is \",round(x,2),\" + (\",round(y,2),\")i ohm\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ " Result \n",
+ "\n",
+ "\n",
+ "\n",
+ " impedance Z2 is 8.5 + ( 17.42 )i ohm"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 8, page no. 437</h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "import cmath\n",
+ "#initializing the variables:\n",
+ "R = 90;# in ohms\n",
+ "XL = 150;# in ohms\n",
+ "ri = 1.35;# in amperes\n",
+ "thetai = 0;# in degrees\n",
+ "\n",
+ "#calculation:\n",
+ "I = ri*math.cos(thetai*math.pi/180) + 1j*ri*math.sin(thetai*math.pi/180)\n",
+ " #Circuit impedance Z\n",
+ "Z = R + 1j*XL\n",
+ " #Supply voltage, V\n",
+ "V = I*Z\n",
+ " #Voltage across 90 ohm\u000e resistor\n",
+ "VR = V.real\n",
+ "#Voltage across inductance, VL\n",
+ "VL = V.imag\n",
+ "xv = V.real\n",
+ "yv = V.imag\n",
+ "rv = (xv**2 + yv**2)**0.5\n",
+ "thetav = cmath.phase(complex(xv,yv))*180/math.pi\n",
+ "phi = thetav - thetai\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "print \"\\n\\n Result \\n\\n\"\n",
+ "print \"\\n (a)Supply voltage, V is \",xv,\" + (\",yv,\")i V\\n\"\n",
+ "print \"\\n (b)Voltage across 90 ohm resistor, VR is \",VR,\" V\\n\"\n",
+ "print \"\\n (c)Voltage across inductance, VL is \",VL,\" V\\n\"\n",
+ "print \"\\n (d)Circuit phase angle is \",round(phi,2),\"deg lagging\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ " Result \n",
+ "\n",
+ "\n",
+ "\n",
+ " (a)Supply voltage, V is 121.5 + ( 202.5 )i V\n",
+ "\n",
+ "\n",
+ " (b)Voltage across 90 ohm resistor, VR is 121.5 V\n",
+ "\n",
+ "\n",
+ " (c)Voltage across inductance, VL is 202.5 V\n",
+ "\n",
+ "\n",
+ " (d)Circuit phase angle is 59.04 deg lagging"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 9, page no. 438</h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "import cmath\n",
+ "#initializing the variables:\n",
+ "R = 25;# in ohms\n",
+ "L = 0.02;# in henry\n",
+ "Vm = 282.8;# in volts\n",
+ "w = 628.4;# in rad/sec\n",
+ "phiv = math.pi/3;# phase angle\n",
+ "\n",
+ "#calculation:\n",
+ " #rms voltage\n",
+ "Vrms = 0.707*Vm*math.cos(phiv) + 0.707*Vm*math.sin(phiv)*1j\n",
+ " #frequency\n",
+ "f = w/(2*math.pi)\n",
+ " #Inductive reactance XL\n",
+ "XL = 2*math.pi*f*L\n",
+ " #Circuit impedance Z\n",
+ "Z = R + XL*1j\n",
+ " #Rms current\n",
+ "Irms = Vrms/Z\n",
+ "phii = cmath.phase(complex(Irms.real, Irms.imag))*180/math.pi\n",
+ "phi = phiv*180/math.pi - phii\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "print \"\\n\\n Result \\n\\n\"\n",
+ "print \"\\n (a)the rms value of voltage is \",round(Vrms.real,2),\" + (\",round( Vrms.imag,2),\")i V\\n\"\n",
+ "print \"\\n (b)the circuit impedance is \",round(R,2),\" + (\",round( XL,2),\")i ohm\\n\"\n",
+ "print \"\\n (c)the rms current flowing is \",round(Irms.real,2),\" + (\",round( Irms.imag,2),\")i A\\n\"\n",
+ "print \"\\n (d)Circuit phase angle is \",round(phi,2),\"deg lagging\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ " Result \n",
+ "\n",
+ "\n",
+ "\n",
+ " (a)the rms value of voltage is 99.97 + ( 173.15 )i V\n",
+ "\n",
+ "\n",
+ " (b)the circuit impedance is 25.0 + ( 12.57 )i ohm\n",
+ "\n",
+ "\n",
+ " (c)the rms current flowing is 5.97 + ( 3.92 )i A\n",
+ "\n",
+ "\n",
+ " (d)Circuit phase angle is 26.69 deg lagging\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 10, page no. 438</h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "import cmath\n",
+ "#initializing the variables:\n",
+ "R = 12;# in ohms\n",
+ "L = 0.10;# in henry\n",
+ "C = 120E-6;# in Farads\n",
+ "f = 50;# in Hz\n",
+ "V = 240;# in volts\n",
+ "\n",
+ "#calculation:\n",
+ " #Inductive reactance, XL\n",
+ "XL = 2*math.pi*f*L\n",
+ " #Capacitive reactance, Xc\n",
+ "Xc = 1/(2*math.pi*f*C)\n",
+ " #Circuit impedance Z\n",
+ "Z = R + 1j*(XL - Xc)\n",
+ "I = V/Z\n",
+ "phii = cmath.phase(complex(I.real, I.imag))*180/math.pi\n",
+ "phiv = 0# in degrees\n",
+ "phi = phiv - phii\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "print \"\\n\\n Result \\n\\n\"\n",
+ "print \"\\n the current flowing is \",round(abs(I),1),\"/_\",round(cmath.phase(complex(I.real,I.imag))*180/math.pi,1),\"deg A\\n\"\n",
+ "print \"and Circuit phase angle is \",round(phi,1),\"deg lagging\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ " Result \n",
+ "\n",
+ "\n",
+ "\n",
+ " the current flowing is 18.5 /_ -22.2 deg A\n",
+ "\n",
+ "and Circuit phase angle is 22.2 deg lagging\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 11, page no. 439</h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "import cmath\n",
+ "#initializing the variables:\n",
+ "C = 50E-6;# in Farads\n",
+ "f = 50;# in Hz\n",
+ "V = 225;# in volts\n",
+ "ri = 1.5;# in Amperes\n",
+ "thetai = -30;# in degrees\n",
+ "\n",
+ "#calculation:\n",
+ "I = ri*math.cos(thetai*math.pi/180) + 1j*ri*math.sin(thetai*math.pi/180)\n",
+ " #Capacitive reactance, Xc\n",
+ "Xc = 1/(2*math.pi*f*C)\n",
+ " #Circuit impedance Z\n",
+ "Z = V/I\n",
+ "R = Z.real\n",
+ "XL = Z.imag + Xc\n",
+ " #inductance L\n",
+ "L = XL/(2*math.pi*f)\n",
+ " #Voltage across coil\n",
+ "Zcoil = R + 1j*XL\n",
+ "Vcoil = I*Zcoil\n",
+ " #Voltage across capacitor,\n",
+ "Vc = I*(-1j*Xc)\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "print \"\\n\\n Result \\n\\n\"\n",
+ "print \"\\n (a)resistance is \",round(R,2),\" ohm and inductance is \",round( L,3),\" H\\n\"\n",
+ "print \"\\n (b)voltage across the coil is \",round(Vcoil.real,2),\" + (\",round( Vcoil.imag,2),\")i V\\n\"\n",
+ "print \"\\n (c)voltage across the capacitor is \",round(Vc.real,2),\" + (\",round( Vc.imag,2),\")i V\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ " Result \n",
+ "\n",
+ "\n",
+ "\n",
+ " (a)resistance is 129.9 ohm and inductance is 0.441 H\n",
+ "\n",
+ "\n",
+ " (b)voltage across the coil is 272.75 + ( 82.7 )i V\n",
+ "\n",
+ "\n",
+ " (c)voltage across the capacitor is -47.75 + ( -82.7 )i V"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 12, page no. 440</h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "import cmath\n",
+ "#initializing the variables:\n",
+ "C = 2.653E-6;# in Farads\n",
+ "R1 = 8;# in ohms\n",
+ "R2 = 5;# in ohms\n",
+ "L = 0.477E-3;# in Henry\n",
+ "f = 4000;# in Hz\n",
+ "ri = 6;# in Amperes\n",
+ "thetai = 0;# in degrees\n",
+ "\n",
+ "#calculation:\n",
+ "I = ri*math.cos(thetai*math.pi/180) + 1j*ri*math.sin(thetai*math.pi/180)\n",
+ " #Capacitive reactance, Xc\n",
+ "Xc = 1/(2*math.pi*f*C)\n",
+ " #impedance Z1\n",
+ "Z1 = R1 - 1j*Xc\n",
+ " #inductive reactance XL\n",
+ "XL = 2*math.pi*f*L\n",
+ " #impedance Z2,\n",
+ "Z2 = R2 + 1j*XL\n",
+ " #voltage V1\n",
+ "V1 = I*Z1\n",
+ " #voltage V2\n",
+ "V2 = I*Z2\n",
+ " #Supply voltage, V\n",
+ "V = V1 + V2\n",
+ "phiv = cmath.phase(complex(V.real, V.imag))*180/math.pi\n",
+ "phi = phiv - thetai\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "print \"\\n\\n Result \\n\\n\"\n",
+ "print \"\\n supply voltage is \",round(V.real,2),\" + (\",round( V.imag,2),\")i V\\n\"\n",
+ "print \"and Circuit phase angle is \",round(phi,2),\"deg leading\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ " Result \n",
+ "\n",
+ "\n",
+ "\n",
+ " supply voltage is 78.0 + ( -18.06 )i V\n",
+ "\n",
+ "and Circuit phase angle is -13.03 deg leading"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |