summaryrefslogtreecommitdiff
path: root/Fundamental_Electrical_and_Electronic_Principles/ch6.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Fundamental_Electrical_and_Electronic_Principles/ch6.ipynb')
-rwxr-xr-xFundamental_Electrical_and_Electronic_Principles/ch6.ipynb721
1 files changed, 721 insertions, 0 deletions
diff --git a/Fundamental_Electrical_and_Electronic_Principles/ch6.ipynb b/Fundamental_Electrical_and_Electronic_Principles/ch6.ipynb
new file mode 100755
index 00000000..d96755d0
--- /dev/null
+++ b/Fundamental_Electrical_and_Electronic_Principles/ch6.ipynb
@@ -0,0 +1,721 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:b84f65369d0a7456fd5ada25a94ec2301f3722e12d3bfd972d934901296bd409"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 6: Alternating Quantities"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.1, Page 202"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "# Comparing alternating voltage v = 35*sin(314.2*t) with the standard Eq.\n",
+ "# Part (a)\n",
+ "V_m = 35; # Maximum value of alternating voltage, volt\n",
+ "\n",
+ "# Part (b)\n",
+ "#We know that v= vm8sin(2*pi*f*t)\n",
+ "#Comparing the alternating voltage equation with the above one, we get,\n",
+ "f = 314.2/(2*math.pi) # Frequency of waveform, Hz\n",
+ "\n",
+ "# Part (c)\n",
+ "T = 1/f; # Time period of waveform, sec\n",
+ "\n",
+ "# Part (d)\n",
+ "t = 3.5; # Time with reference to zero crossing, sec\n",
+ "v = 35*math.sin(2*math.pi*50*3.5*1e-03); # Volatge value after the waveform passes through zero, going positive\n",
+ "\n",
+ "#Results\n",
+ "print \"The maximum value of alternating voltage = %2d volt\"%V_m\n",
+ "print \"The frequency of alternating voltage = %2d Hz\"%f\n",
+ "print \"The time period of alternating voltage = %3.1f ms\"%(T/1e-03);\n",
+ "print \"The volatge value after the waveform passes through zero = %5.2f volt\"%v\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The maximum value of alternating voltage = 35 volt\n",
+ "The frequency of alternating voltage = 50 Hz\n",
+ "The time period of alternating voltage = 20.0 ms\n",
+ "The volatge value after the waveform passes through zero = 31.19 volt\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.2, Page 202"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "# Part (a)\n",
+ "#I = Im*sin(2*pi*f*t)\n",
+ "# Given i = 75*sin(200*%pi*t) mA which on comparing with the general expression gives\n",
+ "#Comparing the above two equations, we get,\n",
+ "f = (200*math.pi)/(2*math.pi) # Frequency of alternating current, Hz\n",
+ "\n",
+ "# Part(b)\n",
+ "i = 35.; # Alternating current after passing through zero, mA\n",
+ "t = math.asin(i/75)/(200*math.pi*1e-03); # Time taken for current to reach 35 mA, ms\n",
+ "\n",
+ "#Results\n",
+ "print \"The frequency of alternating current = %2d Hz\"%f\n",
+ "print \"The time taken for current to reach 35 mA = %5.3f mA\"%t\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The frequency of alternating current = 100 Hz\n",
+ "The time taken for current to reach 35 mA = 0.773 mA\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.3, Page 204"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "V_av = 3.5; # Average value of sinusoidal alternating voltage, V\n",
+ "T = 6.67e-03; # Time period of alternating current, s\n",
+ "\n",
+ "#Calculations\n",
+ "V_m = V_av/0.637; # Peak value of alternating current, V\n",
+ "f = 1/T; # Frequency of alternating volatge, Hz\n",
+ "\n",
+ "#Result\n",
+ "print \"The standard expression for %3.1f voltage = %3.1f sin(%3d*pi*t) volt\"%(V_av, V_m,round(2*f))\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The standard expression for 3.5 voltage = 5.5 sin(300*pi*t) volt\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.4, Page 204"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "V_av = 3.5; # Average value of sinusoidal alternating voltage, V\n",
+ "T = 6.67e-03; # Time period of alternating voltage, s\n",
+ "\n",
+ "#Calculations&Results\n",
+ "V_m = V_av/0.637; # Peak value of alternating voltage, V\n",
+ "f = 1/T; # Frequency of alternating volatge, Hz\n",
+ "\n",
+ "# Part (a)\n",
+ "t = 0.5e-03; # Time taken by the waveform after passing through zero, s\n",
+ "v = V_m*math.sin(2*math.pi*f*t); # Instantaneous value of alternating voltage, s\n",
+ "print \"The instantaneous value of alternating voltage after %3.1f ms = %3.1f volt\"%(t/1e-03, v)\n",
+ "\n",
+ "# Part (b)\n",
+ "t = 4.5e-03; # Time taken by the waveform after passing through zero, s\n",
+ "v = V_m*math.sin(2*math.pi*f*t); # Instantaneous value of alternating voltage, s\n",
+ "print \"The instantaneous value of alternating voltage after %3.1f ms = %3.1f volt\"%(t/1e-03, v);\n",
+ "\n",
+ "# Part (c)\n",
+ "v = 3; # Alternating voltage after passing through zero, mA\n",
+ "t = math.asin(v/V_m)/(2*math.pi*f); # Time taken for current to reach 3 V, s\n",
+ "print \"The time taken for voltage to reach %1d volt = %5.3f ms\"%(v, t/1e-03);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The instantaneous value of alternating voltage after 0.5 ms = 2.5 volt\n",
+ "The instantaneous value of alternating voltage after 4.5 ms = -4.9 volt\n",
+ "The time taken for voltage to reach 3 volt = 0.613 ms\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.5, Page 206"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "V = 240; # Rms vlaue of alternating voltage, volt\n",
+ "\n",
+ "#Calculations\n",
+ "V_m = math.sqrt(2)*V; # Peak value of alternating voltage, volt\n",
+ "\n",
+ "#Result\n",
+ "print \"The amplitude of household %3d volt supply = %5.1f volt\"%(V, V_m);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The amplitude of household 240 volt supply = 339.4 volt\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.6, Page 207"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "pf = 2.5; # Peak factor of non-sinusoidal alternating voltage\n",
+ "V = 240; # Rms vlaue of alternating voltage, volt\n",
+ "\n",
+ "#Calculations\n",
+ "V_m = pf*V; # Peak value of alternating voltage, volt\n",
+ "\n",
+ "#Result\n",
+ "print \"The absolute minimum working voltage = %3d volt\"%V_m\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The absolute minimum working voltage = 600 volt\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.7, Page 207"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "l = 0.25; # Length of the rectangular coil, m\n",
+ "d = 0.2; # Width of rectangular coil, m\n",
+ "N = 80; # Number of turns of the rectangular coil\n",
+ "B = 0.075; # Magnetic flux density, tesla\n",
+ "n = 3000/60; # Frequency of revolution of the coil, rev/s\n",
+ "v = n*math.pi*d; # Linear speed with which the coil sides move, m/s\n",
+ "t = 2e-03; # Time after the emf crosses zero, s\n",
+ "\n",
+ "#Calculations\n",
+ "# Part (a)\n",
+ "# As e = 2*N*B*l*v*sin(2*pi*f*t) volt, and for maximum value of sin(2*pi*f*t) = 1\n",
+ "E_m = 2*N*B*l*v*(1); # Amplitude of emf, volt\n",
+ "E = 0.707*E_m; # rms value of emf, volt\n",
+ "E_av = 0.637*E_m; # Average value of emf, volt\n",
+ "# For a two pole field system, \n",
+ "f = n; # Frequency of generated waveform, Hz\n",
+ "\n",
+ "# Part (b)\n",
+ "T = 1./f; # Time period of generated waveform, Hz\n",
+ "\n",
+ "# Part (c)\n",
+ "e = E_m*math.sin(2*math.pi*f*t); # Instantaneous value at time 2 ms after zero, volt\n",
+ "\n",
+ "#Results\n",
+ "print \"The amplitude, rms and average value of emf = %5.2f V, %5.2f V and %5.2f V resp.\"%(E_m, E, E_av);\n",
+ "print \"The frequency and time period of generated waveform = %2d Hz and %2d ms resp.\"%(f, T/1e-03);\n",
+ "print \"The instantaneous value of emf at time 2 ms after crossing zero = %4.1f V\"%e\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The amplitude, rms and average value of emf = 94.25 V, 66.63 V and 60.04 V resp.\n",
+ "The frequency and time period of generated waveform = 50 Hz and 20 ms resp.\n",
+ "The instantaneous value of emf at time 2 ms after crossing zero = 55.4 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.8, Page 212"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "R_c = 50; # Resistance of the coil of meter, ohm\n",
+ "K = 10e+03; # Figure of merit of the moving coil meter, ohm per volt\n",
+ "V = 10; # d.c. range of coil meter, volt\n",
+ "\n",
+ "#Calculations&Results\n",
+ "# Part (a)\n",
+ "I_fsd = 1/K; # Full scale deflection for moving coil meter, ampere\n",
+ "R = V/I_fsd; # Total meter resistance, ohm\n",
+ "# As R = R_m + R_c, solvign for R_m\n",
+ "R_m = R - R_c; # Multiplier resistance required by the meter, ohm\n",
+ "print \"The multiplier resistance required for 10 V d.c. range = %5.2f k-ohm\"%(R_m/1e+03)\n",
+ "\n",
+ "# Part(b)\n",
+ "I_av = I_fsd; # Average value of ac current, A\n",
+ "I_rms = math.pi/(2*math.sqrt(2))*I_av; # rms value of ac current, A\n",
+ "V = 10 ; # a.c. range of coil meter, volt\n",
+ "R = V/I_rms; # Total meter resistance, ohm\n",
+ "# As R = R_m + R_c, solvign for R_m\n",
+ "R_m = R - R_c; # Multiplier resistance required by the meter, ohm\n",
+ "print \"The multiplier resistance required for 10 V a.c. range = %5.2f k-ohm\"%(R_m/1e+03);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The multiplier resistance required for 10 V d.c. range = 99.95 k-ohm\n",
+ "The multiplier resistance required for 10 V a.c. range = 89.98 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.9, Page 213"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Case_I: Square_wave\n",
+ "ff = 1.11; # Form factor of calibrated meter\n",
+ "ff_square = 1; # Form factor for square wave\n",
+ "V_apparent = 5; # Meter reading for sqaure wave, volt\n",
+ "V_true = V_apparent*1*(ff_square/ff); # True rms value of square wave voltage, volt\n",
+ "print \"The true rms value of square wave voltage = %5.3f V\"%V_true\n",
+ "\n",
+ "# Case_II: Triangular_wave\n",
+ "ff_triangle = 1.15; # Form factor for triangular wave\n",
+ "V_apparent = 5; # Meter reading for triangular wave, volt\n",
+ "V_true = V_apparent*(ff_triangle/ff); # True rms value of triangular wave voltage, volt\n",
+ "print \"The true rms value of triangular wave voltage = %4.2f V\"%V_true\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The true rms value of square wave voltage = 4.505 V\n",
+ "The true rms value of triangular wave voltage = 5.18 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.10, Page 215"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "# The general expression for alternating current is I = Io*sin(2*pi*f*t + phi)\n",
+ "#Comparing the given equations with the above, we get,\n",
+ "f = (80*math.pi)/(2*math.pi) # Frequency of alternating current, Hz\n",
+ "\n",
+ "#Calculations\n",
+ "# I2 is the reference waveform with zero phase angle, so that\n",
+ "phi2 = 0; # Phase angle for reference waveform I2, degrees\n",
+ "Im2 = 3; # Current amplitude of reference waveform I2, A\n",
+ "Im1 = 5; # Current amplitude of reference waveform I1, A\n",
+ "Im3 = 6; # Current amplitude of reference waveform I3, A\n",
+ "phi1 = math.pi/6*(180/math.pi); # Phase angle for reference waveform I1, degrees\n",
+ "phi3 = math.pi/4*(180/math.pi); # Phase angle for reference waveform I3, degrees\n",
+ "\n",
+ "#Results\n",
+ "print \"The frequency of all three waveforms = %2d Hz\"%f\n",
+ "print \"I1 leads I2 by = %2.0f degrees\"%(phi1-phi2);\n",
+ "print \"I3 lags I2 by = %2d degrees\"%(phi3-phi2);\n",
+ "print \"Current amplitude of reference waveform I1 = %1d A\"%Im1\n",
+ "print \"Current amplitude of reference waveform I2 = %1d A\"%Im2\n",
+ "print \"Current amplitude of reference waveform I3 = %1d A\"%Im3\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The frequency of all three waveforms = 40 Hz\n",
+ "I1 leads I2 by = 30 degrees\n",
+ "I3 lags I2 by = 45 degrees\n",
+ "Current amplitude of reference waveform I1 = 5 A\n",
+ "Current amplitude of reference waveform I2 = 3 A\n",
+ "Current amplitude of reference waveform I3 = 6 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.12, Page 218"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Im1 = 7; # Current amplitude of reference waveform I1, A\n",
+ "Im2 = 6; # Current amplitude of reference waveform I2, A\n",
+ "Im3 = 5; # Current amplitude of reference waveform I3, A\n",
+ "Im4 = 4; # Current amplitude of reference waveform I4, A\n",
+ "\n",
+ "#Calculations\n",
+ "phi1 = 70*math.pi/180; # Phase angle for reference waveform I1, rad\n",
+ "phi2 = 0*math.pi/180; # Phase angle for reference waveform I2, rad\n",
+ "phi3 = -50*math.pi/180; # Phase angle for reference waveform I3, rad\n",
+ "phi4 = -90*math.pi/180; # Phase angle for reference waveform I4, rad\n",
+ "\n",
+ "#Results\n",
+ "print \"i1 = %dsin(wt + %4.2f) amp\"%(Im1, phi1)\n",
+ "print \"i2 = %dsin wt amp\"%Im2;\n",
+ "print \"i3 = %dsin(wt + %4.2f) amp\"%(Im3, phi3);\n",
+ "print \"i4 = %dsin(wt + %4.2f) amp\"%(Im4, phi4);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i1 = 7sin(wt + 1.22) amp\n",
+ "i2 = 6sin wt amp\n",
+ "i3 = 5sin(wt + -0.87) amp\n",
+ "i4 = 4sin(wt + -1.57) amp\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.13, Page 221"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "omega = 314.; # Angular frequency of voltage, rad per sec\n",
+ "Vm1 = 25.; # Peak value of first phasor, V\n",
+ "Vm2 = 15.; # Peak value of second phasor, V\n",
+ "\n",
+ "#Calculations\n",
+ "H_C = Vm1*math.cos(math.pi/3)+Vm2*math.cos(-math.pi/6); # Horizontal component of phasor sum, V\n",
+ "V_C = Vm1*math.sin(math.pi/3)+Vm2*math.sin(-math.pi/6); # Vertical component of phasor sum, V\n",
+ "Vm = math.sqrt(H_C**2+V_C**2); # Peak value of phasor sum, V\n",
+ "phi = math.atan(V_C/H_C); # Phase angle, degrees\n",
+ "print \"v = %5.2fsin(%3dt + %5.3f) volt\"%(Vm, omega, phi);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "v = 29.15sin(314t + 0.507) volt\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.14, Page 222"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Im1 = 6; # Peak value of first phasor, A\n",
+ "Im2 = 8; # Peak value of second phasor, A\n",
+ "Im3 = 4; # Peak value of third phasor, A\n",
+ "\n",
+ "#Calculations\n",
+ "H_C = Im1*math.cos(0)+Im2*math.cos(-math.pi/2)+Im3*math.cos(math.pi/6); # Horizontal component of phasor sum, A\n",
+ "V_C = Im1*math.sin(0)+Im2*math.sin(-math.pi/2)+Im3*math.sin(math.pi/6); # Vertical component of phasor sum, A\n",
+ "Im = math.sqrt(H_C**2+V_C**2); # Peak value of phasor sum, V\n",
+ "phi = math.atan(V_C/H_C); # Phase angle, rad\n",
+ "\n",
+ "\n",
+ "print \"i = %4.1fsin(wt%5.3f) amp\"%(Im, phi);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i = 11.2sin(wt-0.565) amp\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.15, Page 222"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "# Part (a)\n",
+ "omega = 628; # Angular frequency of voltage, rad per sec\n",
+ "f = omega/(2*math.pi); # Frequency of the waveforms, Hz\n",
+ "Vm1 = 10.; # Peak value of first phasor, V\n",
+ "Vm2 = 8.; # Peak value of second phasor, V\n",
+ "Vm3 = 12.; # Peak value of third phasor, V\n",
+ "phi1 = -math.pi/6*180/math.pi; # Phase angle for first voltage, degrees\n",
+ "phi2 = math.pi/3*180/math.pi; # Phase angle for second voltage, degrees\n",
+ "phi3 = math.pi/4*180/math.pi; # Phase angle for third voltage, degrees\n",
+ "print \"The frequency of all three waveforms = %3d Hz\"%f\n",
+ "print \"The phase angle and frequency of first voltage : %2d degrees, %2d V\"%(phi1, Vm1);\n",
+ "print \"The phase angle and frequency of second voltage : %2d degrees, %2d V\"%(phi2, Vm2);\n",
+ "print \"The phase angle and frequency of third voltage : %2d degrees, %2d V\"%(phi3, Vm3);\n",
+ "\n",
+ "# Part (b)\n",
+ "H_C = Vm1*math.cos(phi1)+Vm2*math.cos(phi2)+Vm3*math.cos(phi3); # Horizontal component of phasor sum, V\n",
+ "V_C = Vm1*math.sin(phi1)+Vm2*math.sin(phi2)+Vm3*math.sin(phi3); # Horizontal component of phasor sum, V\n",
+ "Vm = math.sqrt(H_C**2+V_C**2); # Peak value of phasor sum, V\n",
+ "phi = math.atan(V_C/H_C); # Phase angle, rad\n",
+ "print \"v = %5.2fsin(%3dt + %5.3f) volt\"%(Vm, omega, phi);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The frequency of all three waveforms = 99 Hz\n",
+ "The phase angle and frequency of first voltage : -29 degrees, 10 V\n",
+ "The phase angle and frequency of second voltage : 59 degrees, 8 V\n",
+ "The phase angle and frequency of third voltage : 45 degrees, 12 V\n",
+ "v = 17.65sin(628t + 1.558) volt\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.16, Page 228"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "tb1 = 0.1e-03; # Timebase of channel 1, s/cm\n",
+ "tb2 = 10e-06; # Timebase of channel 2, s/cm\n",
+ "Y_amp1 = 5.; # Y-amp setting for channel 1, V/cm\n",
+ "Y_amp2 = 0.5; # Y-amp setting for channel 2, V/cm\n",
+ "\n",
+ "#Calculations&Results\n",
+ "# Channel 1\n",
+ "V_pp = 3*Y_amp1; # Peak-to-peak value of waveform in channel 1, V\n",
+ "Vm = V_pp/2; # Amplitude of waveform in channel 1, V\n",
+ "V = Vm/math.sqrt(2); # rms value of sine wave in channel 1, V\n",
+ "T = 4*tb1; # Time period of sine wave, second\n",
+ "f = 1./(T*1000); # Frequency of sine wave, kHz\n",
+ "print \"The amplitude of sine waveform in channel 1 = %3.1f V\"%Vm\n",
+ "print \"The rms value of sine wave in channel 1 = %3.1f V\"%V\n",
+ "print \"The frequency of sine wave in channel 1 = %3.1f kHz\"%f\n",
+ "\n",
+ "# Channel 2\n",
+ "V_pp = 2*Y_amp2; # Peak-to-peak value of waveform in channel 2, V\n",
+ "Vm = V_pp/2; # Amplitude of waveform in channel 2, V\n",
+ "V = Vm; # rms value of square wave in channel 2, V\n",
+ "T = 2./3*tb2; # Time period of square wave, second\n",
+ "f = 1./(T*1000); # Frequency of square wave, kHz\n",
+ "print \"The amplitude of square waveform in channel 2 = %3.1f V\"%Vm\n",
+ "print \"The rms value of square wave in channel 2 = %3.1f V\"%V\n",
+ "print \"The frequency of square wave in channel 2 = %3d kHz\"%f\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The amplitude of sine waveform in channel 1 = 7.5 V\n",
+ "The rms value of sine wave in channel 1 = 5.3 V\n",
+ "The frequency of sine wave in channel 1 = 2.5 kHz\n",
+ "The amplitude of square waveform in channel 2 = 0.5 V\n",
+ "The rms value of square wave in channel 2 = 0.5 V\n",
+ "The frequency of square wave in channel 2 = 150 kHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file