summaryrefslogtreecommitdiff
path: root/Basic_Electrical_Engineering/Chapter8.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Basic_Electrical_Engineering/Chapter8.ipynb')
-rwxr-xr-xBasic_Electrical_Engineering/Chapter8.ipynb1188
1 files changed, 1188 insertions, 0 deletions
diff --git a/Basic_Electrical_Engineering/Chapter8.ipynb b/Basic_Electrical_Engineering/Chapter8.ipynb
new file mode 100755
index 00000000..b22550d5
--- /dev/null
+++ b/Basic_Electrical_Engineering/Chapter8.ipynb
@@ -0,0 +1,1188 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 8: DC TRANSIENTS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.1,Page number: 207 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the current i(0+)=I0.\"\"\"\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "V=24 #Supply voltage(in Volts)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "Req=20+(1.0/((1.0/20)+(1.0/10)))\n",
+ "I=V/Req\n",
+ "I_L=I*(20.0/(20+10))\n",
+ "Io=I_L\n",
+ "i_0_plus=Io\n",
+ "R=20\n",
+ "v_R=(-Io)*R\n",
+ "R1=(20+10)\n",
+ "v_L=Io*R1\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)The current i(0+)=Io=%.2f A.\" %(i_0_plus)\n",
+ "print \"(b)The magnitude of v_R across the 20 Ohms resistor at the instant just after the switch is opened is %.2f V.\" %(v_R)\n",
+ "print \"(c)The magnitude of v_L across the inductor immediately after the switch is opened is %.2f V.\" %(v_L)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The current i(0+)=Io=0.60 A.\n",
+ "(b)The magnitude of v_R across the 20 Ohms resistor at the instant just after the switch is opened is -12.00 V.\n",
+ "(c)The magnitude of v_L across the inductor immediately after the switch is opened is 18.00 V.\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.2,Page number: 208"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding i(0),the power being absorbed by the inductor at t=1 s.\"\"\"\n",
+ "\n",
+ "from math import e,pow,sqrt,log\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "L=1.6 #Self-inductance of the inductor(in Henry)\n",
+ "R=0.8 #Resistance of the resistor(in Ohms)\n",
+ "t=-1.0 #Instant of time(in seconds) \n",
+ "i_minus_1=20.0 #Current at t=1 seconds(in Amperes)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "time_const=L/R\n",
+ "Io=i_minus_1/pow(e,(-t/time_const))\n",
+ "t=1\n",
+ "i_t=Io*pow(e,(-t/time_const))\n",
+ "p_t=i_t*i_t*R\n",
+ "W=100.0\n",
+ "i_t1=sqrt((2*W)/L)\n",
+ "t=-(log(i_t1/Io))*time_const\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)i(0) = %.3f A.\" %(Io)\n",
+ "print \"(b)The power absorbed by the resistor is %.2f W. \" %(p_t) \n",
+ "print \" The inductor by virtue of the emf induced in it,supplies this power to the resistor.\"\n",
+ "print \" Therefore,the power absorbed by the inductor is %.2f W.\" %(-p_t)\n",
+ "print \"(c)The time at which the energy stored in the inductor is 100J is %.5f seconds.\" %(t)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)i(0) = 12.131 A.\n",
+ "(b)The power absorbed by the resistor is 43.31 W. \n",
+ " The inductor by virtue of the emf induced in it,supplies this power to the resistor.\n",
+ " Therefore,the power absorbed by the inductor is -43.31 W.\n",
+ "(c)The time at which the energy stored in the inductor is 100J is 0.16315 seconds.\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.3,Page number: 210"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the value of current in the circuit at an instant 0.4 s after the switch has been closed.\"\"\"\n",
+ "\n",
+ "from math import e,pow,log\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "L=14.0 #Self-inductance of the inductor(in Henry)\n",
+ "R=10.0 #Resistance of the resistor(in Ohms)\n",
+ "V=140.0 #Supply Voltage(in Volts)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "time_const=L/R\n",
+ "t=0.4\n",
+ "Io=V/R\n",
+ "i=Io*(1-pow(e,(-t/time_const)))\n",
+ "i_t=8\n",
+ "t=-time_const*log(i_t/Io)\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)The value of current in the circuit at an instant 0.4 s after the switch has been closed is %.3f A.\" %(i)\n",
+ "print \"(b)The time taken for the current to drop to 8 A after the switch is opened is %.4f seconds.\" %(t)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The value of current in the circuit at an instant 0.4 s after the switch has been closed is 3.479 A.\n",
+ "(b)The time taken for the current to drop to 8 A after the switch is opened is 0.7835 seconds.\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.4,Page number: 210"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the magnitude of the inductor current at t=0- and at t=0+.\"\"\"\n",
+ "\n",
+ "from math import pow,e\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "L=40e-03 #Self-inductance of the inductor(in Henry)\n",
+ "R=80.0 #Resistance of the resistor(in Ohm) \n",
+ "V1=20.0 #Supply voltage-1(in Volts) \n",
+ "V2=40.0 #Supply voltage-2(in Volts)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "time_const=L/R\n",
+ "I_01=V1/R\n",
+ "i_0_minus=I_01\n",
+ "i_0_plus=I_01\n",
+ "I_02=(V1+V2)/R\n",
+ "t=1e-03\n",
+ "i_t=I_01+(I_02-I_01)*(1-pow(e,(-t/time_const)))\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)The magnitude of inductor current at t=0- is %.2f A.\" %(i_0_minus)\n",
+ "print \"(b)The magnitude of inductor current at t=0+ is %.2f A.\" %(i_0_plus)\n",
+ "print \"(c)As t tends to infinity,the current approaches its final steady-state value given as %.2f A.\" %(I_02)\n",
+ "print \"(d)The magnitude of inductor current at t=1 ms is %.3f A.\" %(i_t)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The magnitude of inductor current at t=0- is 0.25 A.\n",
+ "(b)The magnitude of inductor current at t=0+ is 0.25 A.\n",
+ "(c)As t tends to infinity,the current approaches its final steady-state value given as 0.75 A.\n",
+ "(d)The magnitude of inductor current at t=1 ms is 0.682 A.\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.5,Page number: 211"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding i_L(0-),i2(0-),i_L(0+),i_L(20 ms) and i_2(20 ms).\"\"\"\n",
+ "\n",
+ "from math import e,pow\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "V=20.0 #Source Voltage(in Volts)\n",
+ "R1=20.0 #Resistance of resistor-1(in Ohms)\n",
+ "R2=40.0 #Resistance of resistor-2(in Ohms)\n",
+ "R3=30.0 #Resistance of resistor-3(in Ohms)\n",
+ "R4=25.0 #Resistance of resistor-4(in Ohms)\n",
+ "R5=5.0 #Resistance of resistor-5(in Ohms)\n",
+ "L=2.0 #Self-inductance of inductor(in Henry)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "Io=V/(R4+R5)\n",
+ "i_L_0_minus=Io\n",
+ "i_2_0_minus=V/R3\n",
+ "i_L_0_plus=Io\n",
+ "R_45=R4+R5\n",
+ "R_12=R1+R2\n",
+ "Req=R_45+(1/((1/R_12)+(1/R3)))\n",
+ "time_const=L/Req\n",
+ "t=20e-03\n",
+ "i_L_t=Io*pow(e,(-t/time_const))\n",
+ "i_2_t=-i_L_t*(R_12/(R_12+R3))\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)i_L(0-) = %.3f A.\" %(i_L_0_minus)\n",
+ "print \"(b)i_2(0-) = %.3f A.\" %(i_2_0_minus)\n",
+ "print \"(c)i_L(0+) = %.3f A.\" %(i_L_0_plus)\n",
+ "print \"(d)i_L(20 ms) = %.3f A.\" %(i_L_t)\n",
+ "print \"(e)i_2(20 ms) = %.3f A.\" %(i_2_t)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)i_L(0-) = 0.667 A.\n",
+ "(b)i_2(0-) = 0.667 A.\n",
+ "(c)i_L(0+) = 0.667 A.\n",
+ "(d)i_L(20 ms) = 0.404 A.\n",
+ "(e)i_2(20 ms) = -0.270 A.\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.6,Page number: 215"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding v(0+),i(0+) and time constant.\"\"\"\n",
+ "\n",
+ "from math import e,pow\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "R=1.5e03 #Resistance of the resistor(in Ohms) \n",
+ "C=5e-06 #Capacitance of the capacitor(in Farad)\n",
+ "Vo=3.0 #Source Voltage(in Volts)\n",
+ "v_0_plus=0 #Voltage across capacitor at t=0+(in Volts) \n",
+ "v_0_minus=0 #Voltage across capacitor at t=0-(in Volts)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "Io=Vo/R\n",
+ "i_0_plus=Io\n",
+ "time_const=R*C\n",
+ "t=15e-03\n",
+ "v=Vo*(1-pow(e,(-t/time_const))) \n",
+ "i=Io*pow(e,(-t/time_const))\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)Since the voltage across a capacitor cannot change instantaneously, we have, v(0+)=%d V.\" %(v_0_plus)\n",
+ "print \"(b)i(0+)= %.3f mA.\" %(i_0_plus*1000)\n",
+ "print \"(c)The time constant is %.2f ms.\" %(time_const*1000)\n",
+ "print \"(d)At t=15 ms, \\n v=%.5f V. \\n i=%.4f mA.\" %(v,(i*1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Since the voltage across a capacitor cannot change instantaneously, we have, v(0+)=0 V.\n",
+ "(b)i(0+)= 2.000 mA.\n",
+ "(c)The time constant is 7.50 ms.\n",
+ "(d)At t=15 ms, \n",
+ " v=2.59399 V. \n",
+ " i=0.2707 mA.\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.7,Page number: 216\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding v(0+),i(0+) and time constant.\"\"\"\n",
+ "\n",
+ "from math import e,pow\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "R=100 #Resistance of the resistor(in Ohms)\n",
+ "C=5e-06 #Capacitance of the capacitor(in Farads) \n",
+ "Vo=3.0 #Source Voltage(in Volts)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "v_0_plus=Vo\n",
+ "v_0_minus=Vo\n",
+ "Io=Vo/R\n",
+ "i_0_plus=-Io\n",
+ "time_const=R*C\n",
+ "t=1.2e-03\n",
+ "v=Vo*pow(e,(-t/time_const)) \n",
+ "i=-Io*pow(e,(-t/time_const))\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)Since the voltage across a capacitor cannot change instantaneously, we have, v(0+)=%d V.\" %(v_0_plus)\n",
+ "print \"(b)At t=0+, the capacitor behaves as a voltage source of emf Vo. Hence, i(0+)= -Io = %.3f mA.\" %(i_0_plus*1000)\n",
+ "print \"(c) The time constant is %.2f ms.\" %(time_const*1000)\n",
+ "print \"(d)At t=1.2 ms, \\n v=%.5f V. \\n i=%.4f mA.\" %(v,(i*1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Since the voltage across a capacitor cannot change instantaneously, we have, v(0+)=3 V.\n",
+ "(b)At t=0+, the capacitor behaves as a voltage source of emf Vo. Hence, i(0+)= -Io = -30.000 mA.\n",
+ "(c) The time constant is 0.50 ms.\n",
+ "(d)At t=1.2 ms, \n",
+ " v=0.27215 V. \n",
+ " i=-2.7215 mA.\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.8,Page number: 218"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the current i(t) for t>0 seconds.\"\"\"\n",
+ "\n",
+ "#Calculations:\n",
+ "\"\"\" R_Th=(1+10)kilo ohm || (1 kiloohm) \"\"\" #Thevenin's Equivalent Resistance(in Ohms) \n",
+ "\n",
+ "print(\"Note: All currents expressed in mA \\n\")\n",
+ "R_Th=1.0/((1.0/11000)+(1.0/1000))\n",
+ "C=10e-06\n",
+ "time_const=R_Th*C\n",
+ "v_C_0_minus=30.0*((1e03)/((1e03)+(1e03)))\n",
+ "\n",
+ "\"\"\" Applying KVL, 30-(i_0_plus*(1 kilo ohm))-15=0 \"\"\"\n",
+ "\n",
+ "i_0_plus=(30-15)/1.0\n",
+ "i_infinity=30.0/(1+1+10)\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"i(t)= (%.1f + (%.1f-%.1f)*(e to the power -t/%.2f ms)) mA.\" %(i_infinity,i_0_plus,i_infinity,(time_const*1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Note: All currents expressed in mA \n",
+ "\n",
+ "i(t)= (2.5 + (15.0-2.5)*(e to the power -t/9.17 ms)) mA.\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.9,Page number: 220"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the current at t=1 seconds.\"\"\"\n",
+ "\n",
+ "from math import exp,log\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "R=3.0 #Resistance of the coil(in Ohms)\n",
+ "time_const=1.8 #Time constant of the coil(in seconds)\n",
+ "V=10.0 #Supply voltage(in Volts)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "L=time_const*R\n",
+ "i_0_plus=0\n",
+ "I0=V/R\n",
+ "i=I0*(1-exp((-1/time_const)))\n",
+ "t=(log(0.5,e))*(-1.8)\n",
+ "growth=V/L\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)The current at t=1 seconds is given as %.2f A.\" %(i)\n",
+ "print \"(b)The time at which current attains half of its final value is %.2f seconds.\" %(t)\n",
+ "print \"(c)The initial rate of growth of current is %.2f A/s.\" %(growth)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The current at t=1 seconds is given as 1.42 A.\n",
+ "(b)The time at which current attains half of its final value is 1.25 seconds.\n",
+ "(c)The initial rate of growth of current is 1.85 A/s.\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.10,Page number: 220"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the value of current during a sudden change.\"\"\"\n",
+ "\n",
+ "#Calculations:\n",
+ "\"\"\"If I0 is the final steady-state value of current,at t=1 s, we have\n",
+ " \n",
+ " i=Io*(1-exp(-1/time_const)) or (0.741*Io)=Io*(1-exp(-1/time_const));\n",
+ " \n",
+ " exp(-1/time_const)=0.259;\n",
+ " \n",
+ " During the decay of current,we have i(t)=Io*exp(-1/time_const); \n",
+ " \n",
+ " Therefore, at t=1s, we have\n",
+ " \n",
+ " i1=0.259*Io.\n",
+ " \n",
+ " Therefore the value of current in the circuit is 0.259 times the steady state value.\"\"\"\n",
+ "k=1-0.741\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"The value of current in the circuit is %.3f times the steady state value.\" %(k)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of current in the circuit is 0.259 times the steady state value.\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.11,Page number: 220"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the current in the circuit at t=0.6 s.\"\"\"\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "V=120.0 #Supply dc voltage(in Volts)\n",
+ "R=20.0 #Resistance of the resistor(in Ohms)\n",
+ "L=8.0 #Inductance of the inductor(in Henry)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "time_const=L/R\n",
+ "Io=V/R\n",
+ "i=Io*(1-exp(-0.6/time_const))\n",
+ "\"\"\"The voltage drop across R,v_R=i*r=Io*(1-exp(-t/time_const))*R;\n",
+ " The voltage drop across L,v_L=L*(di/dt)=((L*Io)/time_const)*exp(-t/time_const); \n",
+ " \n",
+ " We are to find the time at which these two voltage-drops are same. \"\"\"\n",
+ "t=-time_const*log(0.5,e)\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)The current in the circuit at t=0.6 s is %.2f A.\" %(i)\n",
+ "print \"(b)The time at which the voltage drops across R and L are same is %.3f s.\" %(t)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The current in the circuit at t=0.6 s is 4.66 A.\n",
+ "(b)The time at which the voltage drops across R and L are same is 0.277 s.\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.12,Page number: 221"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the energy stored in the magnetic field.\"\"\"\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "V=30.0 #Supply dc voltage(in Volts)\n",
+ "R=12.0 #Resistance of the resistor(in Ohms)\n",
+ "L=18.0 #Inductance of the inductor(in Henry)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "time_const=L/R\n",
+ "rate_curr=V/L\n",
+ "Io=V/R\n",
+ "i1=(V/R)*(1-exp(-3.0/time_const))\n",
+ "W1=0.5*i1*i1*L\n",
+ "Wlost=(0.5*L*Io*Io)-W1\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)The time constant is %.2f seconds.\" %(time_const)\n",
+ "print \"(b)The initial rate of change of current is %.3f A/s.\" %(rate_curr)\n",
+ "print \"(c)The current at t=3 s is %.2f A.\" %(i1)\n",
+ "print \"(d)The energy stored in the magnetic field at t=3 s is %.3f J.\" %(W1)\n",
+ "print \"(e)The energy lost as heat till t=3 s is %.3f J.\" %(Wlost)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The time constant is 1.50 seconds.\n",
+ "(b)The initial rate of change of current is 1.667 A/s.\n",
+ "(c)The current at t=3 s is 2.16 A.\n",
+ "(d)The energy stored in the magnetic field at t=3 s is 42.055 J.\n",
+ "(e)The energy lost as heat till t=3 s is 14.195 J.\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.13,Page number: 221"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the voltage and current at different time instants.\"\"\"\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "R1=200.0 #Resistance of resistor 1(in Ohms)\n",
+ "L=5e-03 #Inductance of the coil(in Henry)\n",
+ "R2=17.0 #Resistance of resistor 2(in Ohms)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "i_0_plus=20e-03\n",
+ "v_0_plus=i_0_plus*R2\n",
+ "time_const=L/R1\n",
+ "v_L_0_plus=(L*i_0_plus)/time_const\n",
+ "t=20e-06 \n",
+ "i_20=i_0_plus*exp(-t/time_const)\n",
+ "v_20=v_0_plus\n",
+ "t=50e-06\n",
+ "i_50=i_0_plus*exp(-t/time_const)\n",
+ "v_50=v_0_plus\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)The value of i(0+)=%e A.\" %(i_0_plus) \n",
+ "print \"(b)The value of v(0+)=%.3f V.\" %(v_0_plus)\n",
+ "print \"(c)The value of v_L(0+)=%.3f V.\" %(v_L_0_plus)\n",
+ "print \"(d)The value of i at t=20 micro seconds is %e A and v=%.3f V.\" %(i_20,v_20)\n",
+ "print \"(d)The value of i at t=50 micro seconds is %e A and v=%.3f V.\" %(i_50,v_50)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The value of i(0+)=2.000000e-02 A.\n",
+ "(b)The value of v(0+)=0.340 V.\n",
+ "(c)The value of v_L(0+)=4.000 V.\n",
+ "(d)The value of i at t=20 micro seconds is 8.986579e-03 A and v=0.340 V.\n",
+ "(d)The value of i at t=50 micro seconds is 2.706706e-03 A and v=0.340 V.\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.14,Page number: 222"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the currents at t=5 mill seconds.\"\"\"\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "L=0.8 #Self Inductance of the coil(in Henry)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "i_L_0_minus=(120e-03)*(200.0/(200.0+40.0))\n",
+ "Req=40+(1.0/((1.0/800.0)+(1.0/200.0)))\n",
+ "time_const=L/Req\n",
+ "t=5e-03 \n",
+ "i_L=i_L_0_minus*exp(-t/time_const)\n",
+ "i_x=-i_L*(800.0/(800.0+200.0))\n",
+ "i_y=(120e-03)+(-i_L*(200.0/(200.0+800.0)))\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"At t=5 milli seconds,\" \n",
+ "print \"(a)The current i_L=%e A.\" %(i_L)\n",
+ "print \"(b)The current i_x=%e A.\" %(i_x)\n",
+ "print \"(c)The current i_y=%e A.\" %(i_y)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "At t=5 milli seconds,\n",
+ "(a)The current i_L=2.865048e-02 A.\n",
+ "(b)The current i_x=-2.292038e-02 A.\n",
+ "(c)The current i_y=1.142699e-01 A.\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.15,Page number: 223 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the current through an inductor at the time of switching.\"\"\"\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "L=4.0 #Self inductance of inductor(in Henry)\n",
+ "R=10.0 #Resistance of resistor parallel to the inductor(in Ohms)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "\"\"\"By superposition theorem, I_L_0=I_L_1+I_L_2; \"\"\"\n",
+ "I_L1=12.0/4.0\n",
+ "I_L2=2.0\n",
+ "I_L0=I_L1+I_L2\n",
+ "i_L_0_plus=I_L0\n",
+ "w_L_0_plus=0.5*L*I_L0*I_L0\n",
+ "time_const=L/R\n",
+ "t=1.0\n",
+ "i_L=I_L0*exp(-t/time_const)\n",
+ "v_10=-i_L*R\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)The current i_L(0+)=%.2f A. The energy stored in the inductor is w_L(0+)=%.2f J.\" %(i_L_0_plus,w_L_0_plus)\n",
+ "print \"(b)At t=1 second, the current in the inductance is %.2f A and the voltage v_10=%.2f V.\" %(i_L,v_10) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The current i_L(0+)=5.00 A. The energy stored in the inductor is w_L(0+)=50.00 J.\n",
+ "(b)At t=1 second, the current in the inductance is 0.41 A and the voltage v_10=-4.10 V.\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.16,Page number: 223 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the energy stored in the inductor.\"\"\"\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "L=5e-03 #Self inductance of inductor(in Henry)\n",
+ "R=200.0 #Resistance of resistor(in Ohms)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "I_L0=5e-03\n",
+ "time_const=L/R\n",
+ "t=20e-06\n",
+ "i_L=I_L0*exp(-t/time_const)\n",
+ "w=0.5*L*i_L*i_L\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"The energy stored in the inductor after 20 micro seconds of throwing the switch is %e J.\" %(w)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The energy stored in the inductor after 20 micro seconds of throwing the switch is 1.261853e-08 J.\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.17,Page number: 224 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the current in the circuit.\"\"\"\n",
+ "\n",
+ "#Variable DEclaration:\n",
+ "L=8.0 #Self inductance of the coil(in Henry)\n",
+ "R=20.0 #Resistance of resistor(in Ohms)\n",
+ "V=120.0 #Voltage of the supply(in Volts) \n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "Io=V/R\n",
+ "time_const=L/R\n",
+ "t=0.6\n",
+ "i_t=Io*(1-exp(-t/time_const))\n",
+ "\"\"\" The voltage of R at any time is given as v_R(t)=6*(1-exp(-t/0.4))*20=120*(1-exp(-t/0.4));\n",
+ "\n",
+ " The voltage across L at any time is v_L(t)=L*(di/dt)=120*exp(-t/0.4);\n",
+ " \n",
+ " Applying v_L(t)=v_R(t), \"\"\"\n",
+ "t=-log(120.0/240.0)*0.4\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"(a)The current in the circuit at t=0.6 seconds is %.2f A.\" %(i_t)\n",
+ "print \"(b)The time at which the voltage drops across R and L are same is %.4f seconds.\"%(t)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The current in the circuit at t=0.6 seconds is 4.66 A.\n",
+ "(b)The time at which the voltage drops across R and L are same is 0.2773 seconds.\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.18,Page number: 224 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the current i_x in the circuit at different time instants.\"\"\"\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "L=25e-03 #Self inductance of the coil(in Henry)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "I_L0=(10e-03)*(80.0/(80.0+20.0))\n",
+ "i_x_minus_2=I_L0\n",
+ "i_x_0_minus=I_L0\n",
+ "i_x_0_plus=I_L0*(30.0/(30.0+20.0))\n",
+ "Req=1.0/((1.0/20.0)+(1.0/30.0))\n",
+ "time_const=L/Req\n",
+ "t=2e-03\n",
+ "i_L_2=I_L0*exp(-t/time_const)\n",
+ "i_x_2=i_L_2*(30.0/(30.0+20.0))\n",
+ "t=4e-03\n",
+ "i_L_4=I_L0*exp(-t/time_const)\n",
+ "i_x_4=i_L_4*(30.0/(30.0+20.0))\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"The current i_x:\" \n",
+ "print \"At t=-2 ms, i_x=%e A.\" %(i_x_minus_2) \n",
+ "print \"At t=0- ms, i_x=%e A.\" %(i_x_0_minus)\n",
+ "print \"At t=0+ ms, i_x=%e A.\" %(i_x_0_plus)\n",
+ "print \"At t=2 ms, i_x=%e A.\" %(i_x_2)\n",
+ "print \"At t=4 ms, i_x=%e A.\" %(i_x_4)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The current i_x:\n",
+ "At t=-2 ms, i_x=8.000000e-03 A.\n",
+ "At t=0- ms, i_x=8.000000e-03 A.\n",
+ "At t=0+ ms, i_x=4.800000e-03 A.\n",
+ "At t=2 ms, i_x=1.837886e-03 A.\n",
+ "At t=4 ms, i_x=7.037134e-04 A.\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.19,Page number: 225 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the current and voltage at the time of switching.\"\"\"\n",
+ "\n",
+ "#Variable Declaration: \n",
+ "V=1.5 #Voltage of the supply(in Volts)\n",
+ "R1=5e-03 #Resistance of resistor 1(in Ohms) \n",
+ "R2=1.5e03 #Resistance of resistor 2(in Ohms)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "\"\"\"Before the switch is thrown from a to b,the capacitor is fully charged to supply voltage.\n",
+ "\n",
+ " When switching takes place,the capacitor starts discharging through the 5 milli Ohms resistance.\"\"\" \n",
+ "V0=V\n",
+ "v_0_plus=V0\n",
+ "i_0_plus=V0/R1\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"The voltage v(0+)=%.2f V and the current i(0+)=%.2f A.\" %(v_0_plus,i_0_plus)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The voltage v(0+)=1.50 V and the current i(0+)=300.00 A.\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.20,Page number: 226"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the voltage and current at different time intervals.\"\"\"\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "C=5e-06 #Capacitance of the capacitor(in Farads)\n",
+ "V=6.0 #Voltage of the supply(in Volts) \n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "v_0_minus=6.0*((3.0+2.0)/(3.0+2.0+1.0))\n",
+ "R=(1e03+3e03+2e03)\n",
+ "i_0_minus=V/R\n",
+ "v_0_plus=v_0_minus\n",
+ "Vo=v_0_plus\n",
+ "Req=(5e03+3e03+2e03)\n",
+ "time_const=Req*C\n",
+ "i_0_plus=v_0_plus/Req\n",
+ "Io=i_0_plus\n",
+ "t=0.05\n",
+ "v_t1=Vo*exp(-t/time_const)\n",
+ "i_t1=Io*exp(-t/time_const)\n",
+ "t=0.10\n",
+ "v_t2=Vo*exp(-t/time_const)\n",
+ "i_t2=Io*exp(-t/time_const)\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"The values of v(t) and i(t) are: \"\n",
+ "print \"At t=0- s, v(t)=%.3f V and i(t)=%e A.\" %(v_0_minus,i_0_minus)\n",
+ "print \"At t=0+ s, v(t)=%.3f V and i(t)=%e A.\" %(v_0_plus,i_0_plus)\n",
+ "print \"At t=0.05 s, v(t)=%.3f V and i(t)=%e A.\" %(v_t1,i_t1)\n",
+ "print \"At t=0.10 s, v(t)=%.3f V and i(t)=%e A.\" %(v_t2,i_t2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The values of v(t) and i(t) are: \n",
+ "At t=0- s, v(t)=5.000 V and i(t)=1.000000e-03 A.\n",
+ "At t=0+ s, v(t)=5.000 V and i(t)=5.000000e-04 A.\n",
+ "At t=0.05 s, v(t)=1.839 V and i(t)=1.839397e-04 A.\n",
+ "At t=0.10 s, v(t)=0.677 V and i(t)=6.766764e-05 A.\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.21,Page number: 227"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the voltage and current at the time of switching.\"\"\"\n",
+ "\n",
+ "#Calculations:\n",
+ "\"\"\"Using current divider rule, the current through branch AB is determined.\"\"\" \n",
+ "I_AB=10e-03*(1000.0/(1000.0+(800.0+200.0)))\n",
+ "v_0_minus=I_AB*800.0\n",
+ "V_AB=v_0_minus\n",
+ "v_0_plus=V_AB\n",
+ "i_C_0_plus=V_AB/(1.0/((1.0/200.0)+(1.0/800.0)))\n",
+ "i_0_plus=i_C_0_plus*(800.0/(800.0+200.0))\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"The value of v(0+)=%.2f V and the current i(0+)=%e A.\" %(v_0_plus,i_0_plus)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of v(0+)=4.00 V and the current i(0+)=2.000000e-02 A.\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8.22,Page number: 227"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Question:\n",
+ "\"\"\"Finding the voltages across resistor,capacitor and switch.\"\"\"\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "V=12.0 #Voltage of the supply(in Volts)\n",
+ "C=50e-03 #Capacitance of the capacitor(in Farads)\n",
+ "\n",
+ "\n",
+ "#Calculations:\n",
+ "v_C_0_minus=12.0*(20.0/(20.0+4.0))\n",
+ "v_C_0_plus=v_C_0_minus\n",
+ "Vo=v_C_0_plus\n",
+ "Req=5.0+20.0\n",
+ "time_const=Req*C\n",
+ "t=1.0\n",
+ "v_C1=Vo*exp(-t/time_const)\n",
+ "v_R1=v_C1*(20.0/(20.0+5.0))\n",
+ "v_SW1=V-V_R1\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"The value of v_C at t=1 second is %.3f V.\" %(v_C1) \n",
+ "print \"The value of v_R at t=1 second is %.3f V.\" %(v_R1)\n",
+ "print \"The value of v_SW at t=1 second is %.3f V.\" %(v_SW1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of v_C at t=1 second is 4.493 V.\n",
+ "The value of v_R at t=1 second is 3.595 V.\n",
+ "The value of v_SW at t=1 second is 8.405 V.\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file