"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#find the periodic time for 50 Hz and 20kHz frequencies.\n",
"from __future__ import division\n",
"import math\n",
"#initializing the variables:\n",
"f1 = 50;# in Hz\n",
"f2 = 20000;# in Hz\n",
"\n",
"#calculation:\n",
"T1 = 1/f1\n",
"T2 = 1/f2\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n (a) Periodic time T = \",T1,\" secs\\n\"\n",
"print \"\\n (b) Periodic time T = \",(T2/1E-6),\" usecs\\n\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" (a) Periodic time T = 0.02 secs\n",
"\n",
"\n",
" (b) Periodic time T = 50.0 usecs\n",
"\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
Example 2, page no. 195
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#find the frequencies for 4ms and 4us periodic times\n",
"from __future__ import division\n",
"import math\n",
"#initializing the variables:\n",
"T1 = 0.004;# in secs\n",
"T2 = 4E-6;# in secs\n",
"\n",
"#calculation:\n",
"f1 = 1/T1\n",
"f2 = 1/T2\n",
"\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n (a) Frequency f = \",f1,\" Hz\\n\"\n",
"print \"\\n (b) Frequency f = \",(f2/1E6),\" MHz\\n\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" (a) Frequency f = 250.0 Hz\n",
"\n",
"\n",
" (b) Frequency f = 0.25 MHz\n",
"\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
Example 3, page no. 195
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#find the frequency of an alternating current which completes 5 cycles in 8 ms\n",
"from __future__ import division\n",
"import math\n",
"#initializing the variables:\n",
"T = (8E-3)/5;# in secs\n",
"\n",
"#calculation:\n",
"f = 1/T\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n Frequency f = \",f,\" Hz\\n\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" Frequency f = 625.0 Hz"
]
}
],
"prompt_number": 4
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
Example 4, page no. 196
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#determine for each: (i) frequency \n",
"#(ii) average value over half a cycle \n",
"#(iii) rms value\n",
"#(iv) form factor and \n",
"#(v) peak factor\n",
"from __future__ import division\n",
"import math\n",
"#initializing the variables:\n",
"Ta = 0.02;# Time for 1 complete cycle in secs\n",
"Vamax = 200;# in volts\n",
"Va1 = 25;# in volts\n",
"Va2 = 75;# in volts\n",
"Va3 = 125;# in volts\n",
"Va4 = 175;# in volts\n",
"Tb = 0.016;# Time for 1 complete cycle in secs\n",
"Ibmax = 10;# in Amperes\n",
"\n",
"#calculation:\n",
"#for Triangular waveform (Figure 14.5(a))\n",
"fa = 1/Ta\n",
"Aaw = Ta*Vamax/4\n",
"Vaavg = Aaw*2/Ta\n",
"Varms = (((Va1**2) + (Va2**2) + (Va3**2) + (Va4**2))/4)**0.5\n",
"#Note that the greater the number of intervals chosen, the greater the accuracy of the result\n",
"Ffa = Varms/Vaavg\n",
"Pfa = Vamax/Varms\n",
"\n",
"#for Rectangular waveform (Figure 14.5(b))\n",
"fb = 1/Tb\n",
"Abw = Tb*Ibmax/2\n",
"Ibavg = Abw*2/Tb\n",
"Ibrms = 10\n",
"Ffb = Ibrms/Ibavg\n",
"Pfb = Ibmax/Ibrms\n",
"\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n (a1)Frequency f = \",fa,\" Hz\\n\"\n",
"print \"\\n (a2)average value over half a cycle = \",Vaavg,\" V\\n\"\n",
"print \"\\n (a3)rms value = \",round(Varms,2),\" V\\n\"\n",
"print \"\\n (a4)Form factor = \",round(Ffa,2),\"\\n\"\n",
"print \"\\n (a5)Peak factor = \",round(Pfa,2),\"\\n\"\n",
"print \"\\n (b1)Frequency f = \",fb,\" Hz\\n\"\n",
"print \"\\n (b2)average value over half a cycle = \",Ibavg,\" A\\n\"\n",
"print \"\\n (b3)rms value = \",Ibrms,\" A\\n\"\n",
"print \"\\n (b4)Form factor = \",Ffb,\"\\n\"\n",
"print \"\\n (b5)Peak factor = \",Pfb,\"\\n\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" (a1)Frequency f = 50.0 Hz\n",
"\n",
"\n",
" (a2)average value over half a cycle = 100.0 V\n",
"\n",
"\n",
" (a3)rms value = 114.56 V\n",
"\n",
"\n",
" (a4)Form factor = 1.15 \n",
"\n",
"\n",
" (a5)Peak factor = 1.75 \n",
"\n",
"\n",
" (b1)Frequency f = 62.5 Hz\n",
"\n",
"\n",
" (b2)average value over half a cycle = 10.0 A\n",
"\n",
"\n",
" (b3)rms value = 10 A\n",
"\n",
"\n",
" (b4)Form factor = 1.0 \n",
"\n",
"\n",
" (b5)Peak factor = 1.0 "
]
}
],
"prompt_number": 4
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
Example 5, page no. 198
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#find (a) the frequency of the supply, \n",
"#(b) the instantaneous values of current after 1.25 ms and 3.8 ms, (c) the peak or maximum value,\n",
"#(d) the mean or average value, and (e) the rms value of the waveform.\n",
"from __future__ import division\n",
"import math\n",
"import numpy \n",
"from numpy import mean, sqrt, arange\n",
"#initializing the variables:\n",
"Thalf = 5; #in ms\n",
"Ta = 0.02;# Time for 1 complete cycle in secs\n",
"\n",
"#calculation:\n",
"Tfull = 2*Thalf/1000 # in sec\n",
"f = 1/Tfull\n",
"A=[3, 10, 19, 30, 49, 63, 73, 72, 30, 2]\n",
"Iinst125 = 19\n",
"Iinst38 = 70\n",
"sq = 0\n",
"Ipeak = 76\n",
"#B=arange(A)\n",
"Imean = (0.5*1E-3)*numpy.mean(A)*10/(5*1E-3)\n",
"for h in range(10):\n",
" sq = sq + A[h]**2\n",
"\n",
"Irms = sqrt(sq/10)\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n (a)Frequency f = \",f,\" Hz\\n\"\n",
"print \"\\n (b)Instantaneous value of current after 1.25 ms =\",Iinst125,\"A \"\n",
"print \"and Instantaneous value of current after 3.8 ms\", Iinst38,\"A\\n\"\n",
"print \"\\n (c)Peak or maximum value = \",Ipeak,\" A\\n\"\n",
"print \"\\n (d)Mean or average value = \",round(Imean,2),\"A\\n\"\n",
"print \"\\n (e)rms value = \",round(Irms,1),\"A\\n\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" (a)Frequency f = 100.0 Hz\n",
"\n",
"\n",
" (b)Instantaneous value of current after 1.25 ms = 19 A and Instantaneous value of current after 3.8 ms 70 A\n",
"\n",
"\n",
" (c)Peak or maximum value = 76 A\n",
"\n",
"\n",
" (d)Mean or average value = 35.1 A\n",
"\n",
"\n",
" (e)rms value = 43.8 A"
]
}
],
"prompt_number": 3
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
Example 6, page no. 200
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#sinusoidal current has maximum value of 20 A.Calculate its rms value. \n",
"from __future__ import division\n",
"import math\n",
"#initializing the variables:\n",
"Imax = 20;# in Amperes\n",
"\n",
"#calculation:\n",
"#for a sine wave\n",
"Irms = Imax/(2**0.5)\n",
"\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n Rms value = \",round(Irms,2),\" A\\n\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" Rms value = 14.14 A"
]
}
],
"prompt_number": 5
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
Example 7, page no. 200
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#main supply is of 240V.Determine its peak and mean values.\n",
"from __future__ import division\n",
"import math\n",
"#initializing the variables:\n",
"Vrms = 240;# in Volts\n",
"\n",
"#calculation:\n",
"#for a sine wave\n",
"Vmax = Vrms*(2**0.5)\n",
"Vmean = 0.637*Vmax\n",
"\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n peak value = \",round(Vmax,2),\" V\\n\"\n",
"print \"\\n mean value = \",round(Vmean,2),\" V\\n\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" peak value = 339.41 V\n",
"\n",
"\n",
" mean value = 216.2 V"
]
}
],
"prompt_number": 6
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
Example 8, page no. 200
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Determine its maximum value and its rms value\n",
"from __future__ import division\n",
"import math\n",
"#initializing the variables:\n",
"Vmean = 150;# in Volts\n",
"\n",
"#calculation:\n",
"#for a sine wave\n",
"Vmax = Vmean/0.637\n",
"Vrms = 0.707*Vmax\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n peak value = \",round(Vmax,2),\" V\\n\"\n",
"print \"\\n rms value = \",round(Vrms,2),\" V\\n\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" peak value = 235.48 V\n",
"\n",
"\n",
" rms value = 166.48 V"
]
}
],
"prompt_number": 7
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
Example 9, page no. 201
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Find (a) the rms voltage, (b) the frequency and (c) the instantaneous value of voltage when t = 4 ms\n",
"from __future__ import division\n",
"import math\n",
"#initializing the variables:\n",
"Vmax = 282.8;# in Volts\n",
"w = 314;# in rad/sec\n",
"t = 0.004;# in sec\n",
"\n",
"#calculation:\n",
"#for a sine wave\n",
"Vrms = 0.707*Vmax\n",
"f = w/(2*math.pi)\n",
"v = Vmax*math.sin(w*t)\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n (a)rms value = \",round(Vrms,2),\" V\\n\"\n",
"print \"\\n (b)frequency f = \",round(f,2),\" Hz\\n\"\n",
"print \"\\n (c)instantaneous value of voltage at 4 ms = \",round(v,2),\" V\\n\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" (a)rms value = 199.94 V\n",
"\n",
"\n",
" (b)frequency f = 49.97 Hz\n",
"\n",
"\n",
" (c)instantaneous value of voltage at 4 ms = 268.9 V"
]
}
],
"prompt_number": 8
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
Example 10, page no. 202
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Find (a) the amplitude, (b) the peak-to-peak value, \n",
"#(c) the rms value, (d) the periodic time, \n",
"#(e) the frequency, and (f) the phase angle (in degrees and minutes) relative to 75 sin 200(pi*t)\n",
"from __future__ import division\n",
"import math\n",
"#initializing the variables:\n",
"Vmax = 75;# in Volts\n",
"w = 200*math.pi;# in rad/sec\n",
"t = 0.004;# in sec\n",
"phi = 0.25;# in radians\n",
"\n",
"#calculation:\n",
"#for a sine wave\n",
"Vptp = 2*Vmax\n",
"Vrms = 0.707*Vmax\n",
"f = w/(2*math.pi)\n",
"T = 1/f\n",
"v = Vmax*math.sin(w*t)\n",
"phid = phi*180/math.pi\n",
"\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n (a) Amplitude, or peak value = \",Vmax,\" V\\n\"\n",
"print \"\\n (b) Peak-to-peak value = \",Vptp,\" V\\n\"\n",
"print \"\\n (c)rms value = \",Vrms,\" V\\n\"\n",
"print \"\\n (d)periodic time, T = \",T,\" sec\\n\"\n",
"print \"\\n (e)frequency f = \",f,\" Hz\\n\"\n",
"print \"\\n (f)phase angle = \",round(phid,2),\"deg lagging\\n\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" (a) Amplitude, or peak value = 75 V\n",
"\n",
"\n",
" (b) Peak-to-peak value = 150 V\n",
"\n",
"\n",
" (c)rms value = 53.025 V\n",
"\n",
"\n",
" (d)periodic time, T = 0.01 sec\n",
"\n",
"\n",
" (e)frequency f = 100.0 Hz\n",
"\n",
"\n",
" (f)phase angle = 14.32 deg lagging\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
Example 11, page no. 202
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Express the instantaneous voltage in the form v = Vm*sin(wt +- phi)\t\n",
"from __future__ import division\n",
"import math\n",
"#initializing the variables:\n",
"Vmax = 40;# in Volts\n",
"T = 0.01;# in sec\n",
"v = -20;# when t = 0sec, in volts\n",
"t = 0;# in secs\n",
"\n",
"#calculation:\n",
"#for a sine wave\n",
"w = 2*math.pi/T\n",
"phir = math.asin(v/Vmax)\n",
"\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n instantaneous voltage v = \", Vmax,\" sin(\",round(w,2),\"t\",round(phir,2),\") V\\n\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" instantaneous voltage v = 40 sin( 628.32 t -0.52 ) V"
]
}
],
"prompt_number": 1
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
Example 12, page no. 203
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Find:\n",
"#(a) the peak value, the periodic time, the frequency and phase angle relative to 120 sin 100*pi*t\n",
"#(b) the value of the current when t = 0\n",
"#(c) the value of the current when t = 8 ms\n",
"#(d) the time when the current first reaches 60 A, and\n",
"#(e) the time when the current is first a maximum\n",
"from __future__ import division\n",
"import math\n",
"#initializing the variables:\n",
"Imax = 120;# in Amperes\n",
"w = 100*math.pi;# in rad/sec\n",
"phi = 0.36;# in rad\n",
"t1 = 0;# in secs\n",
"t2 = 0.008;# in secs\n",
"i = 60;# in amperes\n",
"\n",
"#calculation:\n",
"#for a sine wave\n",
"f = w/(2*math.pi)\n",
"T = 1/f\n",
"phid = phi*180/math.pi\n",
"i0 = Imax*math.sin((w*t1)+phi)\n",
"i8 = Imax*math.sin((w*t2)+phi) \n",
"ti = (math.asin(i/Imax) - phi)/w\n",
"tm1 = (math.asin(Imax/Imax) - phi)/w\n",
"\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n (a)Peak value = \", Imax,\" A, Periodic time T = \", T,\" sec, \"\n",
"print \" Frequency, f = \", f,\" Hz Phase angle = \",round(phid,2),\"deg leading\\n\"\n",
"print \"\\n (b) When t = 0, i = \",round(i0,2),\" A\\n\"\n",
"print \"\\n (c)When t = 8 ms = \", round(i8,2),\" A\\n\"\n",
"print \"\\n (d)When i is 60 A, then time t = \",round((ti/1E-3),2),\" ms\\n\"\n",
"print \"\\n (e)When the current is a maximum, time, t = \", round((tm1/1E-3),2),\" ms\\n\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" (a)Peak value = 120 A, Periodic time T = 0.02 sec, \n",
" Frequency, f = 50.0 Hz Phase angle = 20.63 deg leading\n",
"\n",
"\n",
" (b) When t = 0, i = 42.27 A\n",
"\n",
"\n",
" (c)When t = 8 ms = 31.81 A\n",
"\n",
"\n",
" (d)When i is 60 A, then time t = 0.52 ms\n",
"\n",
"\n",
" (e)When the current is a maximum, time, t = 3.85 ms\n",
"\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"