summaryrefslogtreecommitdiff
path: root/Basic_Electrical_Engineering/Chapter10.ipynb
diff options
context:
space:
mode:
authorJovina Dsouza2014-07-07 16:34:28 +0530
committerJovina Dsouza2014-07-07 16:34:28 +0530
commitfffcc90da91b66ee607066d410b57f34024bd1de (patch)
tree7b8011d61013305e0bf7794a275706abd1fdb0d3 /Basic_Electrical_Engineering/Chapter10.ipynb
parent299711403e92ffa94a643fbd960c6f879639302c (diff)
downloadPython-Textbook-Companions-fffcc90da91b66ee607066d410b57f34024bd1de.tar.gz
Python-Textbook-Companions-fffcc90da91b66ee607066d410b57f34024bd1de.tar.bz2
Python-Textbook-Companions-fffcc90da91b66ee607066d410b57f34024bd1de.zip
adding book
Diffstat (limited to 'Basic_Electrical_Engineering/Chapter10.ipynb')
-rwxr-xr-xBasic_Electrical_Engineering/Chapter10.ipynb1357
1 files changed, 1357 insertions, 0 deletions
diff --git a/Basic_Electrical_Engineering/Chapter10.ipynb b/Basic_Electrical_Engineering/Chapter10.ipynb
new file mode 100755
index 00000000..946a157a
--- /dev/null
+++ b/Basic_Electrical_Engineering/Chapter10.ipynb
@@ -0,0 +1,1357 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 10: AC CIRCUITS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.1,Page number: 274 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the power factor and the average power dissipated.\"\"\"\n",
+ "\n",
+ "from math import sqrt,pi,cos,degrees\n",
+ "from cmath import rect,phase\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "Vm=141.0 #Peak value of supply voltage(in Volts)\n",
+ "ang_freq=100.0*pi #Angular frequency(in radians per second) \n",
+ "R=3.0 #Resistance(in Ohms) \n",
+ "L=0.0127 #Self-inductance of the coil(in Henry)\n",
+ "\n",
+ "\n",
+ "#Calcultaions:\n",
+ "Vrms=Vm/sqrt(2.0)\n",
+ "V=rect(Vrms,0.0)\n",
+ "X_L=ang_freq*L\n",
+ "Z=R+ (X_L*1j)\n",
+ "I=V/Z\n",
+ "ang_I=degrees(phase(I))\n",
+ "P=Vrms*abs(I)*cos(phase(I))\n",
+ "pf=cos(phase(I))\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)The rms value of the steady-state current is %.2f A and the relative phase angle is %.2f degrees.\" %(abs(I),-ang_I)\n",
+ "print \"(b)The expression for the instantaneous current is i=%.3f sin(100*pi*t%.2f degrees) A.\" %((sqrt(2)*abs(I)),ang_I)\n",
+ "print \"(c)The average power dissipated in the circuit is %.2f W.\" %(P)\n",
+ "print \"(d)The power factor is %.3f lagging.\" %(pf)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The rms value of the steady-state current is 19.97 A and the relative phase angle is 53.06 degrees.\n",
+ "(b)The expression for the instantaneous current is i=28.246 sin(100*pi*t-53.06 degrees) A.\n",
+ "(c)The average power dissipated in the circuit is 1196.75 W.\n",
+ "(d)The power factor is 0.601 lagging.\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.2,Page number: 276"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the capacitance required,the phase angle,the power factor,the apparent power,and the reactive power.\"\"\"\n",
+ "\n",
+ "from math import sqrt,pi,degrees,acos,cos,sin\n",
+ "\n",
+ "#Variable Declaration: \n",
+ "V=230.0 #Rms value of supply voltage(in Volts)\n",
+ "f=50.0 #Frequency of supply(in Hertz) \n",
+ "P_lamp=750.0 #Power rating of the lamp(in Watts) \n",
+ "V_lamp=100.0 #Voltage rating of the lamp(in Volts) \n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "I_rated=P_lamp/V_lamp\n",
+ "Vc=sqrt((V*V)-(V_lamp*V_lamp))\n",
+ "Xc=Vc/I_rated\n",
+ "C=1/(2*pi*f*Xc)\n",
+ "phase_angle=acos(V_lamp/V)\n",
+ "pf=cos(phase_angle)\n",
+ "app_P=V*I_rated\n",
+ "rea_P=V*I_rated*sin(phase_angle)\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)The required capacitance is %e F.\" %(C)\n",
+ "print \"(b)The phase angle is %.3f degrees.\" %(degrees(phase_angle))\n",
+ "print \"(c)The power factor is %.3f leading.\" %(pf)\n",
+ "print \"(d)The apparent power is %.3f VA.\" %(app_P)\n",
+ "print \"(e)The reactive power is %.3f VAr.\" %(rea_P)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The required capacitance is 1.152611e-04 F.\n",
+ "(b)The phase angle is 64.229 degrees.\n",
+ "(c)The power factor is 0.435 leading.\n",
+ "(d)The apparent power is 1725.000 VA.\n",
+ "(e)The reactive power is 1553.424 VAr.\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.3,Page number: 277 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question: \n",
+ "\"\"\"Finding the impedance,the power factor,supply voltage,voltage across resistor,apparent power and reactive power.\"\"\"\n",
+ "\n",
+ "from cmath import rect,phase\n",
+ "from math import pi,cos,sin,degrees\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "I=rect(0.9,0) #Current in the circuit(in Amperes)\n",
+ "R=120.0 #Resistance of the resistor(in Ohms) \n",
+ "Xc=250.0 #Reactance of the capacitor(in Ohms)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "Z=R- Xc*1j\n",
+ "pf=cos(phase(Z))\n",
+ "V=I*Z\n",
+ "V_R=I*R\n",
+ "V_C=I*Xc\n",
+ "act_P=abs(V)*abs(I)*cos(phase(Z))\n",
+ "app_P=abs(V)*abs(I)\n",
+ "rea_P=abs(V)*abs(I)*sin(phase(Z))\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"The impedance is %.3f ohm at a phase angle of %.3f degrees.\" %(abs(Z),degrees(phase(Z)))\n",
+ "print \"The power factor is %.3f leading.\" %(pf)\n",
+ "print \"The supply voltage is %.3f V at a phase angle of %.3f degrees.\" %(abs(V),degrees(phase(V)))\n",
+ "print \"The voltage across resistor is %.3f V at a phase angle of %.3f degrees.\" %(abs(V_R),degrees(phase(V_R)))\n",
+ "print \"The voltage across capacitor is %.3f V at a phase angle of %.3f degrees.\" %(abs(V_C),-90)\n",
+ "print \"The apparent power is %.3f VA.\" %(app_P)\n",
+ "print \"The active power is %.3f W.\" %(act_P)\n",
+ "print \"The reactive power is %.3f VAr.\" %(rea_P)\n",
+ "print \"Note: Negative sign indicates the capacitor supplies reactive power.\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The impedance is 277.308 ohm at a phase angle of -64.359 degrees.\n",
+ "The power factor is 0.433 leading.\n",
+ "The supply voltage is 249.578 V at a phase angle of -64.359 degrees.\n",
+ "The voltage across resistor is 108.000 V at a phase angle of 0.000 degrees.\n",
+ "The voltage across capacitor is 225.000 V at a phase angle of -90.000 degrees.\n",
+ "The apparent power is 224.620 VA.\n",
+ "The active power is 97.200 W.\n",
+ "The reactive power is -202.500 VAr.\n",
+ "Note: Negative sign indicates the capacitor supplies reactive power.\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.4,Page number: 279 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the impedance of the circuit and state whether it is inductive or capacitive.\"\"\"\n",
+ "\n",
+ "from cmath import phase,rect\n",
+ "from math import pi,degrees,radians,cos,sin\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "V=160.0 +120.0*1j #ac sinusoidal voltage(in Volts) \n",
+ "I=-4.0+10.0*1j #Current in circuit(in Amperes) \n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "Z=V/I\n",
+ "\n",
+ "if Z.imag>0:\n",
+ " print(\"The nature of circuit is inductive\\n\")\n",
+ " pf_type=\"lagging\"\n",
+ "\n",
+ "elif Z.imag<0:\n",
+ " print(\"The nature of circuit is capacitive\\n\")\n",
+ " pf_type=\"leading\" \n",
+ " \n",
+ "else:\n",
+ " print(\"The nature of circuit is resistive\\n\")\n",
+ "\n",
+ "pf=cos(phase(Z))\n",
+ "act_P=abs(V)*abs(I)*pf\n",
+ "rea_P=abs(V)*abs(I)*sin(pi+phase(Z))\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"The power factor is %.3f %s.\" %(pf,pf_type)\n",
+ "print \"The active power is %.2f W.\" %(act_P)\n",
+ "print \"The reactive power is %.2f VAr.\" %(rea_P) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The nature of circuit is capacitive\n",
+ "\n",
+ "The power factor is 0.260 leading.\n",
+ "The active power is 560.00 W.\n",
+ "The reactive power is 2080.00 VAr.\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.5,Page number: 280"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the values of the two circuit elements.\"\"\"\n",
+ "\n",
+ "from math import pi\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "f=50 #Frequency of the source(in Hertz)\n",
+ "Z=10+10*1j #Impedance of the circuit(in Ohm) \n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "ang_freq=2*pi*f\n",
+ "R=Z.real\n",
+ "X_L=Z.imag\n",
+ "L=X_L/ang_freq\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"The nature of the impedance indicates that the circiut is inductive.\\n\"\n",
+ "print \"The values of the two elements are: \\n(a)Resistance(R)=%.2f ohm \\n(b)Inductance(C)=%e H.\" %(R,L)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The nature of the impedance indicates that the circiut is inductive.\n",
+ "\n",
+ "The values of the two elements are: \n",
+ "(a)Resistance(R)=10.00 ohm \n",
+ "(b)Inductance(C)=3.183099e-02 H.\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.6,Page number: 280"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the values of the two circuit elements.\"\"\"\n",
+ "\n",
+ "from math import pi\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "f=50.0 #Frequency of the source(in Hertz)\n",
+ "Z=10.0-10.0*1j #Impedance of the circuit(in Ohm) \n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "ang_freq=2.0*pi*f\n",
+ "Y=1.0/Z\n",
+ "R=1/Y.real\n",
+ "C=Y.imag/ang_freq\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"The nature of the impedance indicates that the circiut is capacitive.\\n\"\n",
+ "print \"The values of the two elements are: \\n(a)Resistance(R)=%.2f ohm \\n(b)Capacitance(C)=%e F.\" %(R,C)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The nature of the impedance indicates that the circiut is capacitive.\n",
+ "\n",
+ "The values of the two elements are: \n",
+ "(a)Resistance(R)=20.00 ohm \n",
+ "(b)Capacitance(C)=1.591549e-04 F.\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.7,Page number: 281"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the impedance,the current,the phase angle,the voltage across each element and power factor.\"\"\"\n",
+ "\n",
+ "from cmath import rect,phase\n",
+ "from math import cos,pi,degrees\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "R=12.0 #Resistance of the resistor(in Ohms)\n",
+ "L=0.15 #Self-inductance of the inductor(in Henry)\n",
+ "C=100e-06 #Capacitance of the capacitor(in Farad)\n",
+ "f=50 #Frequency of the source(in Hertz) \n",
+ "V=rect(100,0) #Supply voltage(in Volts) \n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "ang_freq=2*pi*f\n",
+ "X_L=ang_freq*L\n",
+ "X_C=1/(ang_freq*C)\n",
+ "Z=R + (X_L-X_C)*1j\n",
+ "\n",
+ "if Z.imag>0:\n",
+ " pf_type=\"lagging\"\n",
+ "\n",
+ "elif Z.imag<0:\n",
+ " pf_type=\"leading\" \n",
+ " \n",
+ "else:\n",
+ " print(\"The nature of circuit is resistive\\n\")\n",
+ "\n",
+ "I=V/Z\n",
+ "V_R=abs(I)*R\n",
+ "V_C=abs(I)*X_C\n",
+ "V_L=abs(I)*X_L\n",
+ "pf=cos(phase(I))\n",
+ "app_P=abs(V)*abs(I)\n",
+ "avg_P=abs(V)*abs(I)*pf\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)The impedance is %.3f ohm at a phase angle of %.3f degrees.\" %(abs(Z),degrees(phase(Z)))\n",
+ "print \"(b)The current is %.3f A at a phase angle of %.3f degrees.\" %(abs(I),degrees(phase(I)))\n",
+ "print \"(c)The phase angle is %.3f degrees.\" %(degrees(phase(I)))\n",
+ "print \"(d)The voltage across the resistor is %.2f V.\" %(V_R) \n",
+ "print \" The voltage across the capacitor is %.2f V.\\n The voltage across the inductor is %.2f V.\" %(V_C,V_L)\n",
+ "print \"(e)The power factor is %.3f %s.\" %(pf,pf_type)\n",
+ "print \"(f)The apparent power is %.3f VA.\" %(app_P) \n",
+ "print \"(g)The average power is %.3f W.\" %(avg_P)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The impedance is 19.439 ohm at a phase angle of 51.880 degrees.\n",
+ "(b)The current is 5.144 A at a phase angle of -51.880 degrees.\n",
+ "(c)The phase angle is -51.880 degrees.\n",
+ "(d)The voltage across the resistor is 61.73 V.\n",
+ " The voltage across the capacitor is 163.75 V.\n",
+ " The voltage across the inductor is 242.42 V.\n",
+ "(e)The power factor is 0.617 lagging.\n",
+ "(f)The apparent power is 514.431 VA.\n",
+ "(g)The average power is 317.567 W.\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.8,Page number: 285"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the voltage across the capacitor by applying Thevenin's theorem.\"\"\"\n",
+ "\n",
+ "from math import sqrt,degrees\n",
+ "from cmath import rect,phase\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "\"\"\" Note: All the impedances are expresssed in kilo ohm.\"\"\" \n",
+ "ang_freq=3000.0 #Angular frequency(in radians per second)\n",
+ "Vs_m=40.0 #Peak value of the supply voltage(in Volts)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "Vs_rms=Vs_m/sqrt(2.0)\n",
+ "Vs=rect(Vs_rms,0)\n",
+ "Zeq=1.5 + ((1.0-(2.0*1j))/(1j+1.0-2.0*1j))*1.0j\n",
+ "I=Vs/Zeq\n",
+ "Im=abs(I)*sqrt(2)\n",
+ "V_Th=Vs*(1j/(1.5+1j))\n",
+ "Z_Th=1+ ((1.5*1j)/(1.5+1j))\n",
+ "Vc=V_Th*((-2*1j)/(Z_Th-2*1j))\n",
+ "Z_L=Z_Th.real-Z_Th.imag*1j \n",
+ "C=1/(ang_freq*abs(Z_L.imag)*1000)\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)The expression for i(t) can be written as i(t)=%.1f sin(%dt%.2fdegrees) mA.\" %(Im,ang_freq,degrees(phase(I)))\n",
+ "print \"(b)The voltage across the capacitor by applying Thevenin's theorem is %.3f V at a phase angle of %.3f degrees.\" %(abs(Vc),degrees(phase(Vc)))\n",
+ "print \"(c)The values of the two elements of the load impedance that consumes maximum power are R=%e kilo Ohms and C=%e F.\" %(Z_L.real,C)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The expression for i(t) can be written as i(t)=16.0 sin(3000t-36.87degrees) mA.\n",
+ "(b)The voltage across the capacitor by applying Thevenin's theorem is 16.000 V at a phase angle of 8.130 degrees.\n",
+ "(c)The values of the two elements of the load impedance that consumes maximum power are R=1.461538e+00 kilo Ohms and C=4.814815e-07 F.\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.9,Page number: 286"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the value of resistance for a desired power factor.\"\"\"\n",
+ "\n",
+ "from math import sqrt\n",
+ "from cmath import atan\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "pf=0.8 #Power factor of the circuit\n",
+ "X_C=60.0 #Capacitive reactance(in Ohms)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "sin_ang=sqrt(1-(pf*pf))\n",
+ "tan_ang=sin_ang/pf\n",
+ "R=X_C/tan_ang\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"The value of R for which the power factor of the circuit is 0.8 is %.2f Ohms.\" %(R)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of R for which the power factor of the circuit is 0.8 is 80.00 Ohms.\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.10,Page number: 286"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the resistance and the inductance of the coil.\"\"\"\n",
+ "\n",
+ "from math import sqrt,pi\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "Vdc=20.0 #Supply dc voltage(in Volts)\n",
+ "Idc=4.0 #Current drawn by the coil(in Amperes)\n",
+ "f=50.0 #Frequency of supply voltage(in Hertz)\n",
+ "Vs=65.0 #Ac supply voltage(in Volts)\n",
+ "I=5.0 #Current drawn by the choke when connected ac supply(in Amperes)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "R=Vdc/Idc\n",
+ "Z=Vs/I\n",
+ "X_L=sqrt((Z*Z)-(R*R))\n",
+ "L=X_L/(2*pi*f)\n",
+ "pf=R/Z\n",
+ "P=Vs*I*pf\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)The resistance of the coil is %.2f Ohms and the inductance of the coil is %.5f H.\" %(R,L)\n",
+ "print \"(b)The power factor is %.3f lagging.\" %(pf)\n",
+ "print \"(c)The power(real) drawn by the coil is %.3f W.\" %(P) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The resistance of the coil is 5.00 Ohms and the inductance of the coil is 0.03820 H.\n",
+ "(b)The power factor is 0.385 lagging.\n",
+ "(c)The power(real) drawn by the coil is 125.000 W.\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.11,Page number: 286"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the resistance and inductance of the coil.\"\"\"\n",
+ "\n",
+ "from math import pi,pow,sqrt\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "Vs=240.0 #AC supply voltage(in Volts)\n",
+ "f1=50.0 #Frequency of the ac supply voltage(in Hertz) \n",
+ "I1=60.0 #First reading of the ammeter(in Amperes)\n",
+ "f2=100.0 #Frequency of the ac supply voltage(in Hertz)\n",
+ "I2=40.0 #Second reading of the ammeter(in Amperes)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "Z1=Vs/I1\n",
+ "Z2=Vs/I2\n",
+ "L=sqrt(((Z2*Z2)-(Z1*Z1))/((pow((200*pi),2.0))-(pow((100*pi),2.0))))\n",
+ "X1=2*pi*f1*L\n",
+ "R=sqrt((Z1*Z1)-(X1*X1))\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"The resistance of the coil is %.2f Ohms.\" %(R)\n",
+ "print \"The inductance of the coil is %.5f H.\" %(L)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The resistance of the coil is 3.06 Ohms.\n",
+ "The inductance of the coil is 0.00822 H.\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.12,Page number: 287 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the power consumed by the choke coil.\"\"\"\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "R=100.0 #Resistance of the resistor(in Ohms)\n",
+ "V_R=200.0 #Voltage across resistor(in Volts)\n",
+ "V_Ch=300.0 #Voltage across choke coil(in Volts)\n",
+ "Vs=440.0 #Supply voltage(in Volts)\n",
+ "\n",
+ " \n",
+ "#Calculations:\n",
+ "pf=((Vs*Vs)-(V_R*V_R)-(V_Ch*V_Ch))/(2*V_R*V_Ch)\n",
+ "I=V_R/R\n",
+ "P=V_Ch*I*pf\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"The power consumed by the choke coil is %.2f W.\" %(P) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The power consumed by the choke coil is 318.00 W.\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.13,Page number: 287"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the power dissipated in each coil.\"\"\"\n",
+ "\n",
+ "from math import pi\n",
+ "from cmath import phase\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "R1=15.0 #Resistance of the first coil(in Ohms)\n",
+ "L1=0.2 #Inductance of the first coil(in Henry)\n",
+ "R2=25.0 #Resistance of the second coil(in Ohms)\n",
+ "L2=0.04 #Inductance of the second coil(in Henry)\n",
+ "V=230.0 #Supply voltage(in Volts)\n",
+ "f=50.0 #Frequency of supply voltage(in Hertz)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "X1=2*pi*f*L1\n",
+ "X2=2*pi*f*L2\n",
+ "Z1=R1+(1j*X1)\n",
+ "Z2=R2+(1j*X2)\n",
+ "Z=Z1+Z2\n",
+ "I=V/Z\n",
+ "V1=abs(I)*abs(Z1)\n",
+ "V2=abs(I)*abs(Z2)\n",
+ "P1=abs(I)*abs(I)*R1\n",
+ "P2=abs(I)*abs(I)*R2\n",
+ "pf=cos(phase(I))\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)The voltage across the first coil is %.2f V and the voltage across the second coil is %.2f V.\" %(V1,V2)\n",
+ "print \"(b)The power dissipated by the first coil is %.2f W and power dissipated by the second coil is %.2f W.\" %(P1,P2)\n",
+ "print \"(c)The power factor of the whole circuit is %.3f lagging.\" %(pf) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The voltage across the first coil is 174.07 V and the voltage across the second coil is 75.40 V.\n",
+ "(b)The power dissipated by the first coil is 108.92 W and power dissipated by the second coil is 181.54 W.\n",
+ "(c)The power factor of the whole circuit is 0.469 lagging.\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.14,Page number: 288"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the current and power drawn from the source.\"\"\"\n",
+ "\n",
+ "from math import sqrt,pi\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "I_A=8.0 #Current through coil A(in Amperes)\n",
+ "I_B=10.0 #Current through coil B(in Amperes)\n",
+ "V=100.0 #Voltage of the source(in Volts)\n",
+ "f=50.0 #Frequency of the supply(in Hertz)\n",
+ "P_A=120.0 #Power delivered to coil A(in Watts) \n",
+ "P_B=500.0 #Power delivered to coil B(in Watts)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "Z_A=V/I_A\n",
+ "Z_B=V/I_B\n",
+ "R_A=P_A/(I_A*I_A)\n",
+ "R_B=P_B/(I_B*I_B)\n",
+ "X_A=sqrt((Z_A*Z_A)-(R_A*R_A))\n",
+ "X_B=sqrt((Z_B*Z_B)-(R_B*R_B))\n",
+ "R=R_A+R_B\n",
+ "X=X_A+X_B\n",
+ "Z=sqrt((R*R)+(X*X))\n",
+ "I=V/Z\n",
+ "P=I*I*R\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"The current when the two coils are in series is %.2f A and the power taken from the source is %.2f W.\" %(I,P)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The current when the two coils are in series is 4.52 A and the power taken from the source is 140.58 W.\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.15,Page number: 288"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the voltage drop across each coil.\"\"\"\n",
+ "\n",
+ "from math import sqrt,pi\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "V=240.0 #Voltage of the source(in Volts)\n",
+ "f=50.0 #Frequency of the supply(in Hertz)\n",
+ "R_A=5.0 #Resistance of coil A(in Ohms)\n",
+ "L_B=0.015 #Inductance of the coil B(in Henry)\n",
+ "P=3e03 #Active power(in Watts)\n",
+ "Q=2e03 #Reactive power(in VAr)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "S=sqrt((P*P)+(Q*Q))\n",
+ "I=S/V\n",
+ "R_B=(P/(I*I))-R_A\n",
+ "X_B=2*pi*f*L_B\n",
+ "X_A=(Q/(I*I))-X_B\n",
+ "L_A=X_A/(2*pi*f)\n",
+ "Z_A=sqrt((R_A*R_A)+(X_A*X_A))\n",
+ "Z_B=sqrt((R_B*R_B)+(X_B*X_B))\n",
+ "V_A=Z_A*I\n",
+ "V_B=Z_B*I\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)The resistance of coil B is %.2f Ohms.\" %(R_B)\n",
+ "print \"(b)The inductance of coil A is %.5f Henry.\" %(L_A)\n",
+ "print \"(c)The voltage drop across coil A is %.2f V and across coil B is %.2f V.\" %(V_A,V_B)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The resistance of coil B is 8.29 Ohms.\n",
+ "(b)The inductance of coil A is 0.01321 Henry.\n",
+ "(c)The voltage drop across coil A is 97.61 V and across coil B is 143.29 V.\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.16,Page number: 289"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the total power consumed by the circuit and the power factor of the circuit.\"\"\"\n",
+ "\n",
+ "from math import pi\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "P=100.0 #Power rating of the bulb(in Watts)\n",
+ "V=120.0 #Voltage rating of the bulb(in Volts)\n",
+ "Vs=240.0 #Supply voltage(in Volts)\n",
+ "f=50.0 #Frequency of the supply(in Hertz)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "I=P/V\n",
+ "V_R=Vs-V\n",
+ "R=V_R/I\n",
+ "pf_a=1.0\n",
+ "Pt_a=Vs*I\n",
+ "V_C=sqrt((Vs*Vs)-(V*V))\n",
+ "X_C=V_C/I\n",
+ "C=1/(2*pi*X_C*f)\n",
+ "pf_b=V/Vs\n",
+ "Pt_b=Vs*I*pf_b\n",
+ "Vr=I*10.0\n",
+ "V_L=sqrt((Vs*Vs)-((V+Vr)*(V+Vr)))\n",
+ "X_L=V_L/I\n",
+ "L=X_L/(2*pi*f)\n",
+ "V_R_c=V+Vr\n",
+ "pf_c=V_R_c/Vs\n",
+ "Pt_c=Vs*I*pf_c\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)The value of the component used R=%.2f Ohms.\" %(R)\n",
+ "print \" The total power consumed is %.2f W.\" %(Pt_a)\n",
+ "print \" The power factor is %.2f.\" %(pf_a)\n",
+ "print \"(b)The value of the component used C=%e Farad.\" %(C)\n",
+ "print \" The total power consumed is %.2f W.\" %(Pt_b)\n",
+ "print \" The power factor is %.2f leading.\" %(pf_b)\n",
+ "print \"(c)The value of the component used R=10 Ohms and L=%.3f Henry.\" %(L)\n",
+ "print \" The total power consumed is %.2f W.\" %(Pt_c)\n",
+ "print \" The power factor is %.3f lagging.\" %(pf_c)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The value of the component used R=144.00 Ohms.\n",
+ " The total power consumed is 200.00 W.\n",
+ " The power factor is 1.00.\n",
+ "(b)The value of the component used C=1.276224e-05 Farad.\n",
+ " The total power consumed is 100.00 W.\n",
+ " The power factor is 0.50 leading.\n",
+ "(c)The value of the component used R=10 Ohms and L=0.775 Henry.\n",
+ " The total power consumed is 106.94 W.\n",
+ " The power factor is 0.535 lagging.\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.17,Page number: 289\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the value of capacitance C in the cirucit.\"\"\"\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "R=20.0 #Resistance connected in series(in Ohms)\n",
+ "L=15e-03 #Pure inductance in parallel with the capacitor(in Henry)\n",
+ "ang_fre=1000.0 #Angular frequency of voltage source(in radians per second)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "X_L=ang_fre*L\n",
+ "X=R*tan(pi/4.0)\n",
+ "\"\"\"Case 1:(X is inductive)\"\"\"\n",
+ "X_C1=1.0/((1.0/X_L)-(1.0/X))\n",
+ "C1=1.0/(ang_fre*X_C1)\n",
+ "\"\"\"Case 2:(X is capacitive)\"\"\"\n",
+ "X_C2=1.0/((1.0/X_L)+(1.0/X))\n",
+ "C2=1.0/(ang_fre*X_C2)\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"The value of capacitance is:\"\n",
+ "print \"Case 1: If net reactance X is inductive, C=%e Farad.\" %(C1) \n",
+ "print \"Case 2: If net reactance X is capacitive, C=%e Farad.\" %(C2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of capacitance is:\n",
+ "Case 1: If net reactance X is inductive, C=1.666667e-05 Farad.\n",
+ "Case 2: If net reactance X is capacitive, C=1.166667e-04 Farad.\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.18,Page number: 290\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding total current in the circuit.\"\"\"\n",
+ "\n",
+ "from cmath import phase\n",
+ "from math import degrees\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "Z1=(12+1j*15) #Impedance of the first branch(in Ohms) \n",
+ "Z2=(8-1j*4) #Impedance of the second branch(in Ohms)\n",
+ "V=(230+1j*0) #Potential difference across the parallel combination(in Volts)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "I1=V/Z1\n",
+ "I2=V/Z2\n",
+ "I=I1+I2\n",
+ "P=abs(V)*abs(I)*cos(phase(I))\n",
+ "P1=abs(I1)*abs(I1)*(Z1.real)\n",
+ "P2=abs(I2)*abs(I2)*(Z2.real)\n",
+ "pf1=Z1.real/abs(Z1)\n",
+ "pf2=Z2.real/abs(Z2)\n",
+ "pf=cos(phase(I))\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)The current supplied to branch 1 is %.2f A at a phase angle of %.2f degrees.\" %(abs(I1),degrees(phase(I1))) \n",
+ "print \" The current supplied to branch 2 is %.2f A at a phase angle of %.2f degrees.\" %(abs(I2),degrees(phase(I2))) \n",
+ "print \" The total current is %.2f A at a phase angle of %.2f degrees.\\n\" %(abs(I),degrees(phase(I)))\n",
+ "print \"(b)The power consumed by branch 1 is %.2f W.\" %(P1)\n",
+ "print \" The power consumed by branch 2 is %.2f W.\" %(P2)\n",
+ "print \" The total power consumed is %.2f W.\\n\" %(P)\n",
+ "print \"(c)The power factor of branch 1 is %.4f lagging.\" %(pf1)\n",
+ "print \" The power factor of branch 2 is %.4f leading.\" %(pf2)\n",
+ "print \" The overall power factor of the circuit is %.4f leading.\" %(pf)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The current supplied to branch 1 is 11.97 A at a phase angle of -51.34 degrees.\n",
+ " The current supplied to branch 2 is 25.71 A at a phase angle of 26.57 degrees.\n",
+ " The total current is 30.56 A at a phase angle of 4.04 degrees.\n",
+ "\n",
+ "(b)The power consumed by branch 1 is 1720.33 W.\n",
+ " The power consumed by branch 2 is 5290.00 W.\n",
+ " The total power consumed is 7010.33 W.\n",
+ "\n",
+ "(c)The power factor of branch 1 is 0.6247 lagging.\n",
+ " The power factor of branch 2 is 0.8944 leading.\n",
+ " The overall power factor of the circuit is 0.9975 leading.\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.19,Page number: 290\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the resistance and inductance of a coil.\"\"\"\n",
+ "\n",
+ "from math import acos\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "V=230.0 #Voltage of the supply(in Volts)\n",
+ "f=50.0 #Frequency of the supply ac voltage(in Hertz)\n",
+ "R=50.0 #Reistance in series with the coil(in Ohms) \n",
+ "V_coil=180.0 #Voltage across coil(in Volts)\n",
+ "V_R=130.0 #Voltage across resistance(in Volts) \n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "I=V_R/R\n",
+ "\"\"\"From parallelogram OACB,the angle theta is calculated.\"\"\"\n",
+ "cos_theta=((V*V)-(V_R*V_R)-(V_coil*V_coil))/(2*V_R*V_coil)\n",
+ "theta=acos(cos_theta)\n",
+ "V_L=V_coil*sin(theta)\n",
+ "V_r=V_coil*cos(theta)\n",
+ "L=V_L/(I*2*pi*f)\n",
+ "r=V_r/I\n",
+ "P=I*V_r\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)The resistance of the coil is %.2f Ohms and the inductance is %.2f H.\" %(r,L)\n",
+ "print \"(b)The power dissipated in the coil is %.2f W.\" %(P)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The resistance of the coil is 5.33 Ohms and the inductance is 0.22 H.\n",
+ "(b)The power dissipated in the coil is 36.00 W.\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.20,Page number: 291\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the component values of the circuit.\"\"\"\n",
+ "\n",
+ "from math import pi,sqrt,radians,cos\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "Vm=141.4 #Peak value of supply voltage(in Volts) \n",
+ "Im=7.07 #Peak value of current in the series circuit(in Amperes)\n",
+ "ang_fre=2000.0 #Angular frequency of the ac signal(in radians per second) \n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "V=Vm/sqrt(2.0)\n",
+ "I=Im/sqrt(2.0)\n",
+ "Z=V/I\n",
+ "\"\"\" We know that V=I*Z; \n",
+ " \n",
+ " 100=5*sqrt((R*R)+(X_C*X_C));\n",
+ " \n",
+ " (R*R)+(X_C*X_C)=400; \n",
+ " \n",
+ " From the triangle OAB,\n",
+ " \n",
+ " cos(36.87)=V_R/V; \"\"\"\n",
+ "R=(V*cos(radians(36.87)))/I\n",
+ "X_C=sqrt((Z*Z)-(R*R))\n",
+ "C=1.0/(ang_fre*X_C)\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"The elements of the circuit are R=%.2f Ohms and C=%e Farad.\" %(R,C)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The elements of the circuit are R=16.00 Ohms and C=4.166657e-05 Farad.\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.21,Page number: 292\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the voltage and current by Thevenin's theorem.\"\"\"\n",
+ "\n",
+ "from cmath import rect,phase\n",
+ "from math import degrees,radians\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "Vs=rect(100,radians(20))\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "\"\"\"Using voltage divider rule,\"\"\"\n",
+ "Z2=((1j*20)*(15-1j*30))/((1j*20)+(15-1j*30))\n",
+ "Z=10+Z2\n",
+ "I=Vs/Z\n",
+ "V2_div=Vs*(Z2/(10+Z2))\n",
+ "V1_div=V2_div*((-1j*30)/(15-1j*30))\n",
+ "\"\"\"Using Thevenin's theorem,\"\"\"\n",
+ "V_Th=Vs*((15-1j*30)/(10+15-1j*30))\n",
+ "Z_Th=(10*(15-1j*30))/(10+(15-1j*30))\n",
+ "V2=V_Th*((1j*20)/(Z_Th+1j*20))\n",
+ "V_Th=Vs*((1j*20)/(10+1j*20))\n",
+ "Z_Th=15+(1.0/((1.0/10)+(1.0/(1j*20))))\n",
+ "V1=V_Th*((-1j*30)/(Z_Th-1j*30))\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)By voltage divider rule,\"\n",
+ "print \"(i)The current I is %.2f A at an angle of %.2f degrees.\" %(abs(I),degrees(phase(I))) \n",
+ "print \"(ii)The voltage V1 is %.2f V at an angle of %.2f degrees.\" %(abs(V1_div),degrees(phase(V1_div)))\n",
+ "print \"(b)By applying Thevenin's theorem,\"\n",
+ "print \"(i)The voltage V1 is %.2f V at an angle of %.2f degrees.\" %(abs(V1),degrees(phase(V1)))\n",
+ "print \"(ii)The voltage V2 is %.2f V at an angle of %.2f degrees.\" %(abs(V2),degrees(phase(V2)))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)By voltage divider rule,\n",
+ "(i)The current I is 2.32 A at an angle of -28.62 degrees.\n",
+ "(ii)The voltage V1 is 77.30 V at an angle of 5.07 degrees.\n",
+ "(b)By applying Thevenin's theorem,\n",
+ "(i)The voltage V1 is 77.30 V at an angle of 5.07 degrees.\n",
+ "(ii)The voltage V2 is 86.42 V at an angle of 31.63 degrees.\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.22,Page number: 293\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the current by Norton's theorem.\"\"\"\n",
+ "\n",
+ "from cmath import rect,phase\n",
+ "from math import degrees,radians\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "Is=rect(20,radians(45)) #Current supplied by current source(in Amperes)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "\"\"\"Using current divider rule,\"\"\"\n",
+ "Z2=(1j*3)+1.0/((1.0/4)+(1.0/(-1j*5)))\n",
+ "I=Is*(2/(Z2+2))\n",
+ "I_R_div=I*((-1j*5)/(4-1j*5))\n",
+ "\"\"\"Using Norton's theorem,\"\"\"\n",
+ "I_N=Is*(2/(2+1j*3))\n",
+ "Z_N=1.0/((1.0/(2+1j*3))+(1.0/(-1j*5)))\n",
+ "I_R=I_N*(Z_N/(Z_N+4))\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)By current divider rule,\"\n",
+ "print \" The current I_R is %.2f A at an angle of %.2f degrees.\" %(abs(I_R_div),degrees(phase(I_R_div)))\n",
+ "print \"(a)By Norton's theorem,\"\n",
+ "print \" The current I_R is %.2f A at an angle of %.2f degrees.\" %(abs(I_R),degrees(phase(I_R)))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)By current divider rule,\n",
+ " The current I_R is 6.85 A at an angle of -6.95 degrees.\n",
+ "(a)By Norton's theorem,\n",
+ " The current I_R is 6.85 A at an angle of -6.95 degrees.\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10.23,Page number: 294\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the voltage by Thevenin's theorem.\"\"\"\n",
+ "\n",
+ "from cmath import rect,phase\n",
+ "from math import radians,degrees\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "Vs=rect(200,radians(30.0))\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "Z2=((40)*(20+1j*50))/(40+(20+1j*50))\n",
+ "V2=(Vs*Z2)/(Z2-1j*20)\n",
+ "V_div=V2*(20/(20+1j*50))\n",
+ "V_Th=Vs*(40/(40-1j*20))\n",
+ "Z_Th=(1j*50)+1.0/((1.0/(-1j*20))+(1.0/40))\n",
+ "V=(V_Th*20)/(Z_Th+20)\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)V using voltage divider rule is %.2f V at an angle of %.2f degrees.\" %(abs(V_div),degrees(phase(V_div)))\n",
+ "print \"(b)The voltage V using Thevenin's theorem is %.2f V at an angle of %.2f degrees.\" %(abs(V),degrees(phase(V)))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)V using voltage divider rule is 81.23 V at an angle of 6.04 degrees.\n",
+ "(b)The voltage V using Thevenin's theorem is 81.23 V at an angle of 6.04 degrees.\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file