diff options
author | hardythe1 | 2014-07-25 13:33:31 +0530 |
---|---|---|
committer | hardythe1 | 2014-07-25 13:33:31 +0530 |
commit | 5571c8f5bda1334edf8ef9d8c69928d46cc9f163 (patch) | |
tree | bceb7fb14d7903bfb160b856cad72ce1db35b5a9 /Electrical_Circuit_Theory_And_Technology/chapter_32.ipynb | |
parent | 0d4b70aada9bbc982f00c27afb1337e2b314eb43 (diff) | |
download | Python-Textbook-Companions-5571c8f5bda1334edf8ef9d8c69928d46cc9f163.tar.gz Python-Textbook-Companions-5571c8f5bda1334edf8ef9d8c69928d46cc9f163.tar.bz2 Python-Textbook-Companions-5571c8f5bda1334edf8ef9d8c69928d46cc9f163.zip |
removing unwanted and adding book
Diffstat (limited to 'Electrical_Circuit_Theory_And_Technology/chapter_32.ipynb')
-rw-r--r-- | Electrical_Circuit_Theory_And_Technology/chapter_32.ipynb | 432 |
1 files changed, 432 insertions, 0 deletions
diff --git a/Electrical_Circuit_Theory_And_Technology/chapter_32.ipynb b/Electrical_Circuit_Theory_And_Technology/chapter_32.ipynb new file mode 100644 index 00000000..a2070ae8 --- /dev/null +++ b/Electrical_Circuit_Theory_And_Technology/chapter_32.ipynb @@ -0,0 +1,432 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:5db7f11d16032beee814462a087253a6b78ac4c2f805e28898833a5c147fee39"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 32: The superposition theorem</h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 1, page no. 564</h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "import cmath\n",
+ "#initializing the variables:\n",
+ "rv1 = 100;# in volts\n",
+ "rv2 = 50;# in volts\n",
+ "thetav1 = 0;# in degrees\n",
+ "thetav2 = 90;# in degrees\n",
+ "r1 = 25;# in ohm\n",
+ "R = 20;# in ohm\n",
+ "r2 = 10;# in ohm\n",
+ "\n",
+ " #calculation:\n",
+ " #voltage\n",
+ "V1 = rv1*math.cos(thetav1*math.pi/180) + 1j*rv1*math.sin(thetav1*math.pi/180)\n",
+ "V2 = rv2*math.cos(thetav2*math.pi/180) + 1j*rv2*math.sin(thetav2*math.pi/180)\n",
+ " #The circuit diagram is shown in Figure 32.7. Following the above procedure:\n",
+ " #The network is redrawn with the 50/_90\u00b0 V source removed as shown in Figure 32.8\n",
+ " #Currents I1, I2 and I3 are labelled as shown in Figure 32.8.\n",
+ "I1 = V1/(r1 + r2*R/(R + r2))\n",
+ "I2 = (r2/(r2 + R))*I1\n",
+ "I3 = (R/(r2 + R))*I1\n",
+ " #The network is redrawn with the 100/_0\u00b0 V source removed as shown in Figure 32.9\n",
+ " #Currents I4, I5 and I6 are labelled as shown in Figure 32.9.\n",
+ "I4 = V2/(r2 + r1*R/(r1 + R))\n",
+ "I5 = (r1/(r1 + R))*I4\n",
+ "I6 = (R/(r1 + R))*I4\n",
+ " #Figure 32.10 shows Figure 32.9 superimposed on Figure 32.8, giving the currents shown.\n",
+ " #Current in the 20 ohm load,\n",
+ "I20 = I2 + I5\n",
+ " #Current in the 100/_0\u00b0 V source\n",
+ "IV1 = I1 - I6\n",
+ " #Current in the 50/_90\u00b0 V source\n",
+ "IV2 = I4 - I3\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "print \"\\n\\n Result \\n\\n\"\n",
+ "print \"\\n (a)current in the 20 ohm load is \",round(I20.real,2),\" + (\",round(I20.imag,2),\")i A\"\n",
+ "print \"\\n (b)Current in the 100/_0deg V source is \",round(IV1.real,2),\" + (\",round(IV1.imag,2),\")i A\"\n",
+ "print \"\\n (b)Current in the 50/_90deg V source is \",round(IV2.real,2),\" + (\",round(IV2.imag,2),\")i A\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ " Result \n",
+ "\n",
+ "\n",
+ "\n",
+ " (a)current in the 20 ohm load is 1.05 + ( 1.32 )i A\n",
+ "\n",
+ " (b)Current in the 100/_0deg V source is 3.16 + ( -1.05 )i A\n",
+ "\n",
+ " (b)Current in the 50/_90deg V source is -2.11 + ( 2.37 )i A"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 2, page no. 566</h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "import cmath\n",
+ "#initializing the variables:\n",
+ "V1 = 12;# in volts\n",
+ "V2 = 20;# in volts\n",
+ "R1 = 5;# in ohm\n",
+ "R2 = 4;# in ohm\n",
+ "R3 = 2.5;# in ohm\n",
+ "R4 = 6;# in ohm\n",
+ "R5 = 2;# in ohm\n",
+ "\n",
+ "#calculation:\n",
+ " #Removing the 20 V source gives the network shown in Figure 32.12.\n",
+ " #Currents I1 and I2 are shown labelled in Figure 32.12\n",
+ "Re1 = (R4*R5/(R4 + R5)) + R3\n",
+ "Re2 = Re1*R2/(Re1 + R2) + R1\n",
+ "I1 = V1/Re2\n",
+ "I2 = (R2/(Re1 + R2))*I1\n",
+ " #Removing the 12 V source from the original network gives the network shown in Figure 32.14.\n",
+ " #Currents I3, I4 and I5 are shown labelled in Figure 32.14.\n",
+ "Re3 = (R1*R2/(R1 + R2)) + R3\n",
+ "Re4 = Re3*R4/(Re3 + R4) + R5\n",
+ "I3 = V2/Re4\n",
+ "I4 = (R4/(Re3 + R4))*I3\n",
+ "I5 = (R1/(R1 + R2))*I4\n",
+ " #Superimposing Figure 32.14 on Figure 32.12 shows that the current flowing in the 4 ohm resistor is given by\n",
+ "Ir4 = I5 - I2\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "print \"\\n\\n Result \\n\\n\"\n",
+ "print \"\\ncurrent in the 4 ohm resistor of the network is \",round(Ir4,2),\" A\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ " Result \n",
+ "\n",
+ "\n",
+ "\n",
+ "current in the 4 ohm resistor of the network is 0.48 A"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 3, page no. 567</h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "import cmath\n",
+ "#initializing the variables:\n",
+ "rv1 = 30;# in volts\n",
+ "rv2 = 30;# in volts\n",
+ "thetav1 = 45;# in degrees\n",
+ "thetav2 = -45;# in degrees\n",
+ "R1 = 4;# in ohm\n",
+ "R2 = 4;# in ohm\n",
+ "R3 = 1j*3;# in ohm\n",
+ "R4 = -1j*10;# in ohm\n",
+ "\n",
+ " #calculation:\n",
+ " #voltage\n",
+ "V1 = rv1*math.cos(thetav1*math.pi/180) + 1j*rv1*math.sin(thetav1*math.pi/180)\n",
+ "V2 = rv2*math.cos(thetav2*math.pi/180) + 1j*rv2*math.sin(thetav2*math.pi/180)\n",
+ " #The network is redrawn with V2 removed, as shown in Figure 32.17.\n",
+ " #Current I1 and I2 are shown in Figure 32.17. From Figure 32.17,\n",
+ "Re1 = R4*(R2 + R3)/(R4 + R3 + R2)\n",
+ "Re2 = Re1 + R1\n",
+ " #current\n",
+ "I1 = V1/Re2\n",
+ "I2 = (R4/(R2 + R3 + R4))*I1\n",
+ " #The original network is redrawn with V1 removed, as shown in Figure 32.18\n",
+ " #Currents I3 and I4 are shown in Figure 32.18. From Figure 32.18,\n",
+ "Re3 = R1*(R2 + R3)/(R1 + R3 + R2)\n",
+ "Re4 = Re3 + R4\n",
+ "I3 = V2/Re4\n",
+ "I4 = (R1/(R2 + R3 + R1))*I3\n",
+ " #If the network of Figure 32.18 is superimposed on the network of Figure 32.17, \n",
+ " #it can be seen that the current in the (4+i3) ohm impedance is given by\n",
+ "Ir4i3 = I2 - I4\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "print \"\\n\\n Result \\n\\n\"\n",
+ "print \"current in (4 + i3) ohm impedance of the network is \",round(Ir4i3.real,2),\" + (\",round( Ir4i3.imag,2),\")i A\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ " Result \n",
+ "\n",
+ "\n",
+ "current in (4 + i3) ohm impedance of the network is 2.15 + ( 0.42 )i A\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 4, page no. 568</h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "import cmath\n",
+ "#initializing the variables:\n",
+ "E1 = 5 + 0j;# in volts\n",
+ "E2 = 2 + 4j;# in volts\n",
+ "Z1 = 3 + 4j;# in ohm\n",
+ "Z2 = 2 - 5j;# in ohm\n",
+ "Z3 = 6 + 8j;# in ohm\n",
+ "\n",
+ "#calculation:\n",
+ " #The original network is redrawn with E2 removed, as shown in Figure 32.20.\n",
+ " #Currents I1, I2 and I3 are labelled as shown in Figure 32.20.\n",
+ "Ze1 = Z3*Z2/(Z3 + Z2)\n",
+ "Ze2 = Ze1 + Z1\n",
+ " #current\n",
+ "I1 = E1/Ze2\n",
+ "I2 = (Z2/(Z3 + Z2))*I1\n",
+ "I3 = (Z3/(Z3 + Z2))*I1\n",
+ " #The original network is redrawn with E1 removed, as shown in Figure 32.22\n",
+ " #Currents I4, I5 and I6 are shown labelled in Figure 32.22 \n",
+ " #with I4 flowing away from the positive terminal of the E2 source.\n",
+ "Ze3 = Z3*Z1/(Z3 + Z1)\n",
+ "Ze4 = Ze3 + Z2\n",
+ "I4 = E2/Ze4\n",
+ "I5 = (Z1/(Z3 + Z1))*I4\n",
+ "I6 = (Z3/(Z3 + Z1))*I4\n",
+ " #If the network of Figure 32.18 is superimposed on the network of Figure 32.17, \n",
+ " #it can be seen that the current in the (4+i3) ohm impedance is given by\n",
+ "i1 = I1 + I6\n",
+ "i2 = I3 + I4\n",
+ "i3 = I2 - I5\n",
+ " #magnitude\n",
+ "i1mag = abs(i1)\n",
+ "i2mag = abs(i2)\n",
+ "E1mag = abs(E1)\n",
+ "E2mag = abs(E2)\n",
+ " #phase\n",
+ "phi1 = cmath.phase(complex(i1.real,i1.imag))\n",
+ "phi2 = cmath.phase(complex(i2.real,i2.imag))\n",
+ " #voltage across the(6 + i8) ohm impedance\n",
+ "V6i8 = i3*Z3\n",
+ "V6i8m = abs(V6i8)\n",
+ " #power\n",
+ "P = (E1mag*i1mag*math.cos(phi1)) + (E2mag*i2mag*math.cos(phi2 - cmath.phase(complex(E2.real,E2.imag))))\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "print \"\\n\\n Result \\n\\n\"\n",
+ "print \"\\n(a)currents are: \\n \",round(i1.real,2),\" + (\",round( i1.imag,2),\")i A, \\n \",round(i2.real,2),\" + (\",round(i2.imag,2),\")i A \\n and \",round(i3.real,2),\" + (\",round(i3.imag,2),\")i A\"\n",
+ "print \"\\n(b)current in the (6 + i8) ohm resistor of the network is \",round(V6i8m,2),\" V\"\n",
+ "print \"\\n(c)the total active power delivered to the network is \",round(P,2),\" W\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ " Result \n",
+ "\n",
+ "\n",
+ "\n",
+ "(a)currents are: \n",
+ " 0.57 + ( 0.62 )i A, \n",
+ " 0.56 + ( 1.33 )i A \n",
+ " and 0.01 + ( -0.71 )i A\n",
+ "\n",
+ "(b)current in the (6 + i8) ohm resistor of the network is 7.09 V\n",
+ "\n",
+ "(c)the total active power delivered to the network is 9.29 W"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 5, page no. 571</h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "import cmath\n",
+ "#initializing the variables:\n",
+ "rv1 = 50;# in volts\n",
+ "rv2 = 30;# in volts\n",
+ "thetav1 = 0;# in degrees\n",
+ "thetav2 = 90;# in degrees\n",
+ "R1 = 20;# in ohm\n",
+ "R2 = 5;# in ohm\n",
+ "R3 = -1j*3;# in ohm\n",
+ "R4 = 8;# in ohm\n",
+ "R5 = 8;# in ohm\n",
+ "\n",
+ "#calculation:\n",
+ " #voltage\n",
+ "V1 = rv1*math.cos(thetav1*math.pi/180) + 1j*rv1*math.sin(thetav1*math.pi/180)\n",
+ "V2 = rv2*math.cos(thetav2*math.pi/180) + 1j*rv2*math.sin(thetav2*math.pi/180)\n",
+ " #The network is redrawn with the V2 source removed, as shown in Figure 32.26.\n",
+ " #Currents I1 to I5 are shown labelled in Figure 32.26. \n",
+ " #current\n",
+ "Re1 = R4*R5/(R5 + R4) + R3\n",
+ "Re2 = Re1*R2/(R2 + Re1)\n",
+ "I1 = V1/(Re2 + R1)\n",
+ "I2 = (Re1/(R2 + Re1))*I1\n",
+ "I3 = (R2/(Re1 + R2))*I1\n",
+ "I4 = (R4/(R4 + R5))*I3\n",
+ "I5 = I3 - I4\n",
+ " #The original network is redrawn with the V1 source removed, as shown in Figure 32.27.\n",
+ " #Currents I6 to I10 are shown labelled in Figure 32.27\n",
+ "Re3 = R1*R2/(R1 + R2)\n",
+ "Re4 = Re3 + R3\n",
+ "Re5 = Re4*R4/(Re4 + R4)\n",
+ "Re6 = Re5 + R5\n",
+ "I6 = V2/Re6\n",
+ "I7 = (Re4/(Re4 + R4))*I6\n",
+ "I8 = (R4/(Re4 + R4))*I6\n",
+ "I9 = (R1/(R1 + R2))*I8\n",
+ "I10 = (R2/(R1 + R2))*I8\n",
+ " #current flowing in the capacitor is given by\n",
+ "Ic = I3 - I8\n",
+ " #magnitude of the current in the capacitor\n",
+ "Icmag = abs(Ic)\n",
+ "\n",
+ "i1 = I2 + I9\n",
+ "i1mag = abs(i1)\n",
+ " #magnitude of the p.d. across the 5 ohm resistance is given by\n",
+ "Vr5m = i1mag*R2\n",
+ " #Active power dissipated in the 20 ohm resistance is given by\n",
+ "i2 = I1 - I10\n",
+ "i2mag = abs(i2)\n",
+ "phii2 = cmath.phase(complex(i2.real,i2.imag))\n",
+ "Pr20 = R1*(i2mag)**2\n",
+ " #Active power developed by the V1\n",
+ "P1 = rv1*i2mag*math.cos(phii2)\n",
+ " #Active power developed by V2 source\n",
+ "i3 = I6 - I5\n",
+ "i3mag = abs(i3)\n",
+ "phii3 = cmath.phase(complex(i3.real,i3.imag))\n",
+ "P2 = rv2*i3mag*math.cos(phii3 - (thetav2*math.pi/180))\n",
+ " #Total power developed\n",
+ "P = P1 + P2\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "print \"\\n\\n Result \\n\\n\"\n",
+ "print \"\\n(a)the magnitude of the current flowing in the capacitor is \",round(Icmag,2),\" A\"\n",
+ "print \"\\n(b) the p.d. across the 5 ohm resistance is \",round(Vr5m,2),\" V\"\n",
+ "print \"\\n(c)the active power dissipated in the 20 ohm resistance is \",round(Pr20,0),\" W\"\n",
+ "print \"\\n(d)the total active power taken from the supply is \",round(P,1),\" W\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ " Result \n",
+ "\n",
+ "\n",
+ "\n",
+ "(a)the magnitude of the current flowing in the capacitor is 2.11 A\n",
+ "\n",
+ "(b) the p.d. across the 5 ohm resistance is 5.85 V\n",
+ "\n",
+ "(c)the active power dissipated in the 20 ohm resistance is 111.0 W\n",
+ "\n",
+ "(d)the total active power taken from the supply is 191.9 W"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |