From 8048392490bd2efe0fdfa001945f663cba969841 Mon Sep 17 00:00:00 2001 From: nice Date: Thu, 9 Oct 2014 18:07:00 +0530 Subject: updated books --- BASIC_ELECTRICAL_ENGINEERING_/Chapter9.ipynb | 1092 ++++++++++++++++++++++++++ 1 file changed, 1092 insertions(+) create mode 100755 BASIC_ELECTRICAL_ENGINEERING_/Chapter9.ipynb (limited to 'BASIC_ELECTRICAL_ENGINEERING_/Chapter9.ipynb') diff --git a/BASIC_ELECTRICAL_ENGINEERING_/Chapter9.ipynb b/BASIC_ELECTRICAL_ENGINEERING_/Chapter9.ipynb new file mode 100755 index 00000000..299b89e3 --- /dev/null +++ b/BASIC_ELECTRICAL_ENGINEERING_/Chapter9.ipynb @@ -0,0 +1,1092 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 9:ALTERNATING CURRENT AND VOLTAGE" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.1,Page number: 237" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the angle at which the instantaneous value of voltage is 10 V.\"\"\"\n", + "\n", + "from math import asin,degrees\n", + "\n", + "#Variable Declaration:\n", + "Vm=20.0 #Peak value of sinusoidal voltage(in Volts)\n", + "\n", + "\n", + "#Calculations:\n", + "v=10.0 #Instantaneous Voltage(in Volts)\n", + "angle=degrees(asin(v/Vm))\n", + "\n", + "\n", + "#Result:\n", + "print \"(a)The angle at which the instantaneous value of voltage is 10V is %.2f degrees.\" %(angle)\n", + "print \"(b)The maximum value of voltage is Vm=20 V.This occurs twice in one cycle at angles 90 degrees and 270 degrees.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The angle at which the instantaneous value of voltage is 10V is 30.00 degrees.\n", + "(b)The maximum value of voltage is Vm=20 V.This occurs twice in one cycle at angles 90 degrees and 270 degrees.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.2,Page number: 237" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the time represented by a 60 degrees phase angle.\"\"\"\n", + "\n", + "from math import pi,sin,radians\n", + "\n", + "#Variable Declaration:\n", + "ang_freq=2000.0 #Angular Frequency(in radians per second)\n", + "\n", + "\n", + "#Calculations:\n", + "f=ang_freq/(2*pi)\n", + "T=1/f\n", + "t=160e-06\n", + "v=0.04*sin((2000*t)+radians(60))\n", + "t_60=(60.0/360)*T\n", + "\n", + "\n", + "#Result:\n", + "print \"(a)The frequency is %.2f Hz.\" %(f)\n", + "print \"(b)The angular frequency is %.2f rad/sec.\" %(ang_freq)\n", + "print \"(c)The instantaneous voltage when t=60 micro seconds, is %e V.\" %(v)\n", + "print \"(d)The time represented by 60 degrees phase angle is %e seconds.\" %(t_60)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The frequency is 318.31 Hz.\n", + "(b)The angular frequency is 2000.00 rad/sec.\n", + "(c)The instantaneous voltage when t=60 micro seconds, is 3.917381e-02 V.\n", + "(d)The time represented by 60 degrees phase angle is 5.235988e-04 seconds.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.3,Page number: 237" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the equation for the instantaneous value of a sinusoidal voltage.\"\"\"\n", + "\n", + "from math import pi,sin,radians,degrees,asin\n", + "\n", + "#Variable Declaration:\n", + "V_peak_to_peak=20.0 #Peak-to-peak Voltage(in Volts)\n", + "\n", + "\n", + "#Calculations:\n", + "V_m=V_peak_to_peak/2\n", + "T=10.0e-03\n", + "f=1/T\n", + "ang_freq=2*pi*f\n", + "phi=180-degrees(asin(3.6/V_m))\n", + "t=12e-03\n", + "v_12=V_m*sin((ang_freq*t)-radians(phi))\n", + "\n", + "\n", + "#Result:\n", + "print \"(a)The equation of the given sinusoidal voltage is v(t)=%.2f sin(%.2ft+%.2f) V.\" %(V_m,ang_freq,phi)\n", + "print \"(b)The value of voltage at 12ms would be %.3f V.\" %(v_12)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The equation of the given sinusoidal voltage is v(t)=10.00 sin(628.32t+158.90) V.\n", + "(b)The value of voltage at 12ms would be -9.985 V.\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.4,Page number: 238" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the equation for the instantaneous value of an alternating current.\"\"\"\n", + "\n", + "from math import pi,sin,asin\n", + "\n", + "#Variable Declaration:\n", + "f=60.0 #Frequency of alternating current(in Hertz)\n", + "i_m=12.0 #Peak value of the alternating current(in Amperes) \n", + "\n", + "\n", + "#Calculations:\n", + "ang_freq=2*pi*f\n", + "t1=1.0/360\n", + "i_t1=i_m*sin(ang_freq*t1)\n", + "i2=9.6\n", + "t2=(asin(9.6/12))/ang_freq\n", + "\n", + "\n", + "#Result:\n", + "print \"(a)The equation for the instantaneous value of alternating current is i= %d sin(%.2ft) A.\" %(i_m,ang_freq)\n", + "print \"(b)The value of current at t=1/360 second is %.2f A.\" %(i_t1)\n", + "print \"(c)The time taken to reach 9.6A for the first time is %e seconds.\" %(t2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The equation for the instantaneous value of alternating current is i= 12 sin(376.99t) A.\n", + "(b)The value of current at t=1/360 second is 10.39 A.\n", + "(c)The time taken to reach 9.6A for the first time is 2.459727e-03 seconds.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.5,Page number: 244" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the phase difference between two sinusoidal currents.\"\"\"\n", + "\n", + "from math import pi\n", + "\n", + "#Calculations:\n", + "ang_freq=100.0*pi\n", + "f=ang_freq/(2.0*pi)\n", + "T=1/f\n", + "t=(30.0/360.0)*T\n", + "\n", + "\n", + "#Result:\n", + "print \"The phase difference in terms of time is %e seconds.\" %(t)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The phase difference in terms of time is 1.666667e-03 seconds.\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.6,Page number: 248 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the power consumed by a resistor.\"\"\"\n", + "\n", + "from cmath import phase\n", + "\n", + "#Variable Declaration:\n", + "R=10 #Resistance of resistance(in Ohms) \n", + "I=4+ 1j*3 #Alternating current phasor(in Amperes)\n", + "\n", + "\n", + "#Calculations:\n", + "I_mod=abs(I)\n", + "I_phase= phase(I)\n", + "I_rms=I_mod\n", + "P=pow(I_rms,2)*R\n", + "\n", + "\n", + "#Result:\n", + "print \"The power consumed by the 10 ohm resistor is %.2f W.\" %(P)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The power consumed by the 10 ohm resistor is 250.00 W.\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.7,Page number: 250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question: \n", + "\"\"\"Finding the resultant current obtained by adding two alternating currents.\"\"\"\n", + "\n", + "from cmath import rect,phase\n", + "from math import radians,degrees,sqrt\n", + "\n", + "#Calculations:\n", + "I1=rect(10,0)\n", + "I2=rect(20,radians(60))\n", + "I=I1+I2\n", + "Im=abs(I)\n", + "I_phase=degrees(phase(I))\n", + "\n", + "\n", + "#Result:\n", + "print \"The resultant current is %.2f A at a phase angle of %.2f degrees.\" %(Im,I_phase)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The resultant current is 26.46 A at a phase angle of 40.89 degrees.\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.8,Page number: 250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the rms value of the sum of two currents.\"\"\"\n", + "\n", + "from cmath import rect\n", + "from math import radians,sqrt\n", + "\n", + "#Calculations:\n", + "I1=rect((10*sqrt(2)),0)\n", + "I2=rect((20*sqrt(2)),radians(60))\n", + "I=I1+I2\n", + "Im=abs(I)\n", + "Irms=Im/(sqrt(2))\n", + "\n", + "\n", + "#Result:\n", + "print \"The rms value of the sum of the currents is %.2f A.\" %(Irms) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rms value of the sum of the currents is 26.46 A.\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.9,Page number: 250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the rms value of the resultant current.\"\"\"\n", + "\n", + "from cmath import rect,phase\n", + "from math import radians,sqrt,degrees\n", + "\n", + "#Calculations:\n", + "I1=rect(5,0)\n", + "I2=rect(5,radians(30))\n", + "I3=rect(5,radians(-120))\n", + "I=I1+I2+I3\n", + "Im=abs(I)\n", + "Irms=Im/(sqrt(2))\n", + "I_phase=degrees(phase(I))\n", + "\n", + "\n", + "#Result:\n", + "print \"The rms value of the resultant current that leaves the junction is %.2f A at a phase angle of %.2f degrees.\" %(Irms,I_phase) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rms value of the resultant current that leaves the junction is 5.00 A at a phase angle of -15.00 degrees.\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.10,Page number: 251" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the average and rms value of the resultant cuurent in a wire.\"\"\"\n", + "\n", + "from math import sqrt\n", + "\n", + "#Variable Declaration: \n", + "I1rms=10.0 #Rms value of direct current(in Amperes) \n", + "\n", + "\n", + "#Calculations:\n", + "avg=10.0 \n", + "I2rms=10.0/sqrt(2)\n", + "I_rms=sqrt(pow(I1rms,2)+pow(I2rms,2))\n", + "\n", + "\n", + "#Result:\n", + "print \"The average value of the resultant current is %d A as the current goes as much positive as negative around the value of %d A.\" %(avg,avg) \n", + "print \"The rms value of the resultant current is %.3f A.\" %(I_rms)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The average value of the resultant current is 10 A as the current goes as much positive as negative around the value of 10 A.\n", + "The rms value of the resultant current is 12.247 A.\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.11,Page number: 252" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the average value of a voltage waveform.\"\"\"\n", + "\n", + "#Calculations:\n", + "area_0_to_1=10*(1e-03)\n", + "area_1_to_3=-5*(2e-03)\n", + "area_3_to_4=20*(1e-03)\n", + "area_4_to_5=0*(1e-03)\n", + "area_5_to_8=5*(3e-03)\n", + "total_area=(area_0_to_1+area_1_to_3+area_3_to_4+area_4_to_5+area_5_to_8)\n", + "total_period=8e-03\n", + "avg_value=total_area/total_period\n", + "\n", + "\n", + "#Result:\n", + "print \"The average value of the alternating voltage waveform is %.3f V.\" %(avg_value)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The average value of the alternating voltage waveform is 4.375 V.\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.12,Page number: 252" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the effective value of a voltage waveform.\"\"\"\n", + "\n", + "from math import sqrt\n", + "\n", + "#Calculations:\n", + "area_0_to_10=400*(10e-03)\n", + "area_10_to_20=100*(10e-03)\n", + "total_area=(area_0_to_10+area_10_to_20)\n", + "total_period=20e-03\n", + "avg_value_of_square=total_area/total_period\n", + "rms=sqrt(avg_value_of_square)\n", + "\n", + "\n", + "#Result:\n", + "print \"The effective(rms) value of the alternating voltage waveform is %.3f V.\" %(rms) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The effective(rms) value of the alternating voltage waveform is 15.811 V.\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.13,Page number: 253" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the rms value,the average value and the form factor for a current waveform.\"\"\"\n", + "\n", + "from math import sqrt\n", + "\n", + "#Variable Declaration:\n", + "period=3.0 #Time period of the current waveform(in seconds)\n", + "\n", + "\n", + "#Calculations:\n", + "Irms=sqrt( ((pow(10,2)*2)+(pow(0,2)*1))/3 )\n", + "Iavg=((10.0*2)+(0*1))/3.0\n", + "form_factor=Irms/Iavg\n", + "\n", + "\n", + "#Result:\n", + "print \"The rms value of current waveform is %.2f A.\" %(Irms) \n", + "print \"The average value of current waveform is %.2f A.\" %(Iavg) \n", + "print \"The form factor of the current waveform is %.2f.\" %(form_factor) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rms value of current waveform is 8.12 A.\n", + "The average value of current waveform is 6.67 A.\n", + "The form factor of the current waveform is 1.22.\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.14,Page number: 253" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the form factor and the peak factor for a saw-tooth waveform.\"\"\"\n", + "\n", + "from math import sqrt\n", + "\n", + "#Variable Declaration:\n", + "T=5e-03 #Time period of saw-tooth waveform(in seconds) \n", + "V_m=10.0 #Peak value of the saw-tooth voltage(in Volts)\n", + "\n", + "\"\"\" Vav=(Area under the curve in one cycle)/(Duration of one cycle) \"\"\"\n", + "\n", + "\n", + "#Calculations:\n", + "Vav=((1.0/2)*V_m*T)/T\n", + "Vrms=V_m/(sqrt(3))\n", + "form_factor=Vrms/Vav\n", + "peak_factor=V_m/Vrms\n", + "\n", + "\n", + "#Result:\n", + "print \"The average value of the saw-tooth voltage waveform is %.3f V.\" %(Vav)\n", + "print \"The rms value of the saw-tooth voltage waveform is %.3f V.\" %(Vrms)\n", + "print \"The form factor for the saw-tooth voltage waveform is %.3f.\" %(form_factor)\n", + "print \"The peak factor for the saw-tooth voltage waveform is %.3f.\" %(peak_factor)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The average value of the saw-tooth voltage waveform is 5.000 V.\n", + "The rms value of the saw-tooth voltage waveform is 5.774 V.\n", + "The form factor for the saw-tooth voltage waveform is 1.155.\n", + "The peak factor for the saw-tooth voltage waveform is 1.732.\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.15,Page number: 255 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the average power,the apparent power,the instantaneous power and the power factor in percentage in an ac circuit.\"\"\"\n", + "\n", + "from math import cos,sqrt,pi\n", + "\n", + "#Variable Declaration:\n", + "phase_angle=pi/5 #Phase difference between the alternating current and alternating voltage(in radians) \n", + "Vm=55 #Peak value of the alternating voltage(in Volts) \n", + "Im=6.1 #Peak value of the alternating current(in Amperes)\n", + "\n", + "\n", + "#Calculations:\n", + "Vrms=Vm/sqrt(2)\n", + "Irms=Im/sqrt(2)\n", + "pf=cos(phase_angle)\n", + "P_avg=Vrms*Irms*cos(phase_angle)\n", + "P_app=Vrms*Irms\n", + "P_inst=P_avg-(Vrms*Irms*cos((2*0.3)-(pi/5)))\n", + "\n", + "\n", + "#Result:\n", + "print \"The average power is %.2f W.\" %(P_avg)\n", + "print \"The apparent power is %.2f VA.\" %(P_app)\n", + "print \"The instantaneous power at wt=0.3 is %.2f W.\" %(P_inst)\n", + "print \"The power factor is %.3f lagging.\" %(pf)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The average power is 135.71 W.\n", + "The apparent power is 167.75 VA.\n", + "The instantaneous power at wt=0.3 is -31.97 W.\n", + "The power factor is 0.809 lagging.\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.16,Page number:262" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the average and rms values of waveforms.\"\"\"\n", + "\n", + "from math import sqrt\n", + "\n", + "#Variable Declaration:\n", + "Vm1=10.0 #Peak voltage of first waveform(in Volts) \n", + "Vm2=10.0 #Peak voltage of second waveform(in Volts)\n", + "\n", + "\n", + "#Calculations:\n", + "Vav1=Vm1/2.0\n", + "Vrms1=Vm1/sqrt(3.0)\n", + "Vav2=Vm2/4.0\n", + "Vrms2=Vm2/sqrt(6.0)\n", + "\n", + "\n", + "#Result:\n", + "print \"(a)The average value of the voltage is %.2f V and the rms value of the voltage is %.2f V.\" %(Vav1,Vrms1) \n", + "print \"(b)The average value of the voltage is %.2f V and the rms value of the voltage is %.2f V.\" %(Vav2,Vrms2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The average value of the voltage is 5.00 V and the rms value of the voltage is 5.77 V.\n", + "(b)The average value of the voltage is 2.50 V and the rms value of the voltage is 4.08 V.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.17,Page number:263" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"Finding the value of current at a given instant.\"\"\"\n", + "\n", + "from math import pi,sin,asin\n", + "\n", + "#Variable Declaration:\n", + "Im=12.0 #Maximum value of the alternating current(in Amperes)\n", + "f=60.0 #Frequency of the alternating current(in Hertz)\n", + "\n", + "\n", + "#Calculations:\n", + "w=2*pi*f\n", + "t=1/360.0\n", + "i=Im*sin(w*t)\n", + "i1=9.6\n", + "t=asin(i1/Im)/w\n", + "\n", + "\n", + "#Result:\n", + "print \"(a)The equation for the instantaneous current is i(t)=%.2f sin(%.2f*t) A.\" %(Im,w)\n", + "print \"(b)The value of the current after (1/360) second is %.2f A.\" %round(i,2)\n", + "print \"(c)The time taken to reach 9.6 A for the first time is %e seconds.\" %(t)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The equation for the instantaneous current is i(t)=12.00 sin(376.99*t) A.\n", + "(b)The value of the current after (1/360) second is 10.39 A.\n", + "(c)The time taken to reach 9.6 A for the first time is 2.459727e-03 seconds.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.18,Page number:263" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the expression of an alternating current in cosine form.\"\"\"\n", + "\n", + "from math import asin,pi\n", + "\n", + "#Variable Declaration:\n", + "Imax=10.0 #Maximum value of current(in Amperes)\n", + "Io=5.0 #Value of current at t=0(in Amperes)\n", + "\n", + "\n", + "#Calculations:\n", + "phi=asin(Io/Imax)\n", + "phi_new=(pi/2.0)-phi\n", + "\n", + "\n", + "#Result:\n", + "print \"The expression for current is i=%.2f cos(wt-%.2f) A.\" %(Imax,phi_new)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The expression for current is i=10.00 cos(wt-1.05) A.\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.19,Page number:264" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the time(from negative value) at which the instantaneous current is 10/sqrt(2.0) A.\"\"\"\n", + "\n", + "from math import pi,sqrt,radians,asin\n", + "\n", + "#Variable Declaration:\n", + "Irms=20.0 #Rms value of alternating current(in Amperes)\n", + "f=50.0 #Frequency of the alternating current(in Hertz)\n", + "\n", + "\n", + "#Calculations:\n", + "ang_freq=2*pi*f\n", + "Im=Irms*sqrt(2.0)\n", + "i=10.0*sqrt(2.0)\n", + "ph_lag=pi/2.0\n", + "t=(asin(i/Im)+ph_lag)/ang_freq\n", + "\n", + "\n", + "#Result:\n", + "print \"The time(measured from negative value) at which instantaneous current will be 10/sqrt(2.0) is %.2f ms.\" %round((t*1000),2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The time(measured from negative value) at which instantaneous current will be 10/sqrt(2.0) is 6.67 ms.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.20,Page number:264" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the average and rms value of an alternating current.\"\"\"\n", + "\n", + "from math import pow,sqrt\n", + "\n", + "#Variable Declaration:\n", + "Idc=10.0 #Dc current(in Amperes)\n", + "Im=5.0 #Peak value of sinusoidal component(in Volts)\n", + "\n", + "\n", + "#Calculations:\n", + "Iav=Idc\n", + "Irms=sqrt((10*10)+pow((5.0/sqrt(2.0)),2))\n", + "\n", + "\n", + "#Result:\n", + "print \"The average value of current is %.2f A.\" %(Iav)\n", + "print \"The rms value of current is %.2f A.\" %(Irms)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The average value of current is 10.00 A.\n", + "The rms value of current is 10.61 A.\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.21,Page number:264" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the sum of three alternating voltages.\"\"\"\n", + "\n", + "from math import radians,degrees\n", + "from cmath import rect,phase\n", + "\n", + "#Calculations:\n", + "v1=rect(147.3,radians(188.1))\n", + "v2=rect(294.6,radians(45))\n", + "v3=rect(88.4,radians(135))\n", + "v_res=v1+v2+v3\n", + "\n", + "\n", + "#Result:\n", + "print \"The resultant voltage is v=%.2f sin(wt+(%.2f degrees)) V.\" %(abs(v_res),degrees(phase(v_res)))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The resultant voltage is v=250.07 sin(wt+(90.01 degrees)) V.\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.22,Page number:265" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the reactance offered by an inductor and a capacitor.\"\"\"\n", + "\n", + "from math import pi\n", + "\n", + "#Variable Declaration:\n", + "L=0.2 #Inductance of the inductor(in Henry)\n", + "C=10e-06 #Capacitance of the capacitor(in Farads)\n", + "f=100 #Initial frequency of the ac input voltage(in Hertz)\n", + "f1=140 #New frequency of the ac input voltage(in Hertz)\n", + "\n", + "\n", + "#Calculations:\n", + "X_L=2*pi*f*L\n", + "X_C=1.0/(2*pi*f*C)\n", + "X_L1=2*pi*f1*L\n", + "X_C1=1.0/(2*pi*f1*C)\n", + "\n", + "\n", + "#Result:\n", + "print \"(a)For a frequency of 100Hz, X_L=%.2f Ohms and X_C=%.2f Ohms.\" %(X_L,X_C)\n", + "print \"(a)For a frequency of 140Hz, X_L=%.2f Ohms and X_C=%.2f Ohms.\" %(X_L1,X_C1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)For a frequency of 100Hz, X_L=125.66 Ohms and X_C=159.15 Ohms.\n", + "(a)For a frequency of 140Hz, X_L=175.93 Ohms and X_C=113.68 Ohms.\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.23,Page number:265" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Question:\n", + "\"\"\"Finding the currents in each case.\"\"\"\n", + "\n", + "from math import radians,degrees\n", + "from cmath import rect,phase\n", + "\n", + "#Calculations:\n", + "I1=rect(10,0)\n", + "I2=rect(10,0)\n", + "Ia=I1+I2\n", + "I1=rect(10,radians(90))\n", + "Ib=I1+I2\n", + "I1=rect(10,radians(-90))\n", + "I2=rect(10,radians(-90))\n", + "Ic=I1+I2\n", + "V=250.0+1j*0\n", + "X_L=1j*25.0\n", + "Id=V/X_L\n", + "X_C=-1j*25.0\n", + "I=5.0+1j*0\n", + "Ve=I*X_C\n", + "\n", + "\n", + "#Result:\n", + "print \"(a)The unknown current is %.2f A at a phase angle of %.2f degrees.\" %(abs(Ia),degrees(phase(Ia)))\n", + "print \"(a)The unknown current is %.2f A at a phase angle of %.2f degrees.\" %(abs(Ib),degrees(phase(Ib)))\n", + "print \"(a)The unknown current is %.2f A at a phase angle of %.2f degrees.\" %(abs(Ic),degrees(phase(Ic)))\n", + "print \"(a)The unknown current is %.2f A at a phase angle of %.2f degrees.\" %(abs(Id),degrees(phase(Id)))\n", + "print \"(a)The unknown voltage is %.2f A at a phase angle of %.2f degrees.\" %(abs(Ve),degrees(phase(Ve)))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The unknown current is 20.00 A at a phase angle of 0.00 degrees.\n", + "(a)The unknown current is 14.14 A at a phase angle of 45.00 degrees.\n", + "(a)The unknown current is 20.00 A at a phase angle of -90.00 degrees.\n", + "(a)The unknown current is 10.00 A at a phase angle of -90.00 degrees.\n", + "(a)The unknown voltage is 125.00 A at a phase angle of -90.00 degrees.\n" + ] + } + ], + "prompt_number": 6 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file -- cgit