diff options
author | Thomas Stephen Lee | 2015-08-28 16:53:23 +0530 |
---|---|---|
committer | Thomas Stephen Lee | 2015-08-28 16:53:23 +0530 |
commit | db0855dbeb41ecb8a51dde8587d43e5d7e83620f (patch) | |
tree | b95975d958cba9af36cb1680e3f77205354f6512 /sample_notebooks/MohdAnwar/Chapter4_1.ipynb | |
parent | 5a86a20b9de487553d4ef88719fb0fd76a5dd6a7 (diff) | |
download | Python-Textbook-Companions-db0855dbeb41ecb8a51dde8587d43e5d7e83620f.tar.gz Python-Textbook-Companions-db0855dbeb41ecb8a51dde8587d43e5d7e83620f.tar.bz2 Python-Textbook-Companions-db0855dbeb41ecb8a51dde8587d43e5d7e83620f.zip |
add books
Diffstat (limited to 'sample_notebooks/MohdAnwar/Chapter4_1.ipynb')
-rw-r--r-- | sample_notebooks/MohdAnwar/Chapter4_1.ipynb | 424 |
1 files changed, 424 insertions, 0 deletions
diff --git a/sample_notebooks/MohdAnwar/Chapter4_1.ipynb b/sample_notebooks/MohdAnwar/Chapter4_1.ipynb new file mode 100644 index 00000000..66a0b7e3 --- /dev/null +++ b/sample_notebooks/MohdAnwar/Chapter4_1.ipynb @@ -0,0 +1,424 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:fc56911ca78177974b04004faec461a6b97c01b43d461299fb0cf06eea3ba6da" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter4 - Analog Electronic Volt-Ohm Milliammeters" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.2.1 - page : 4-4" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Peak amplitude\n", + "#given data :\n", + "E_rms=230.0 #in V\n", + "Ep=2**(1.0/2)*E_rms \n", + "print \"Peak amplitude, Ep = \", round(Ep,2), \" V.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Peak amplitude, Ep = 325.27 V.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.12.1 - page : 4-21" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Resistance\n", + "#given data :\n", + "import math\n", + "Rm=500.0 #in ohm\n", + "E_rms=50.0 # in V\n", + "E_dc=(2**(1.0/2)*E_rms)/(math.pi/2) \n", + "Im=1*10**-3 #in A\n", + "R=E_dc/Im \n", + "Rs=(R-Rm)*10**-3 \n", + "print \"The resistance, Rs = \", round(Rs,1), \" kohm.\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The resistance, Rs = 44.5 kohm.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.14.1 - page : 4-25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Percentage error\n", + "ff1=1.0 #form factor\n", + "r=1.11 #sine wave form factor\n", + "per=((r-ff1)/ff1)*100 #percentage error\n", + "print \"Percentage error is \", per, \" %\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Percentage error is 11.0 %\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.14.2 - page : 4-26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#part (i)\n", + "# form factor\n", + "T1=3.0 #\n", + "T=range(0,4) \n", + "##Function for integration\n", + "def integrate(a,b,f):\n", + " # def function before using this\n", + " # eg. : f=lambda t:200**2*t**2\n", + " #a=lower limit;b=upper limit;f is a function\n", + " import numpy\n", + " N=1000 # points for iteration\n", + " t=numpy.linspace(a,b,N)\n", + " ft=f(t)\n", + " ans=numpy.sum(ft)*(b-a)/N\n", + " return ans\n", + "# Calculating Vrms\n", + "a=T[0]\n", + "b=T[3]\n", + "f=lambda t:200**2*t**2\n", + "Vrms=(1/T1*integrate(a,b,f))**(1.0/2) # V\n", + "# Calculating Vav\n", + "g=lambda t:200*t\n", + "Vav=1/T1*integrate(a,b,g) # V\n", + "ff=Vrms/Vav # form factor\n", + "print \"Form factor is \", round(ff,4)\n", + "# part (ii)\n", + "ff1=1.11 #form factor of sine wave\n", + "per=((ff1/ff)-1)*100 #percentage errpr\n", + "print \"Percentage error in meter indication is\", round(per,3), \" %\"\n", + "# Answer is not accurate in the textbook." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Form factor is 1.155\n", + "Percentage error in meter indication is -3.895 %\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.19.1 - page : 4-43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Current\n", + "#Given data :\n", + "gm=0.005 #in mho\n", + "V1=1.5 #in V\n", + "rd=200.0*10**3 # in Ohm\n", + "Rd=15.0*10**3 #in ohm\n", + "Rm=75.0 #in ohm\n", + "I=(gm*V1*((Rd*rd)/(rd+Rd)))/((2*((Rd*rd)/(rd+Rd)))+Rm) # A\n", + "I*=10**3 # mA\n", + "print \"Current, I = \", round(I,2), \" mA\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Current, I = 3.74 mA\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.19.2 - page : 4-44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Current\n", + "#Given data :\n", + "gm=0.005 #in mho\n", + "V1=[0.2,0.4,0.6,0.8,1.0] #in V\n", + "rd=200.0*10**3 # in Ohm\n", + "Rd=15.0*10**3 #in ohm\n", + "Rm=75.0 #in ohm\n", + "Im=[]\n", + "for v1 in V1:\n", + " Im.append(gm*(rd*Rd*v1/(rd+Rd))/(2.0*(rd*Rd/(rd+Rd))+Rm)*1000) # mA\n", + "#Im*=1000 # mA\n", + "print \"Voltage Current\"\n", + "i=0\n", + "for im in Im:\n", + " print V1[i],\" V \",round(Im[i],3),\" A\"\n", + " i+=1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Voltage Current\n", + "0.2 V 0.499 A\n", + "0.4 V 0.997 A\n", + "0.6 V 1.496 A\n", + "0.8 V 1.995 A\n", + "1.0 V 2.493 A\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.19.3 - page : 4-44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Design\n", + "v1=100.0 # in V\n", + "v2=30.0 #in V\n", + "v3=103.0 # in V\n", + "v4=1.0 #in V\n", + "x=9.0 #assume input resistance in Mohm\n", + "r4=(v4/v3)*x*10**3 #in kohm\n", + "r3=(((v4/v1)*x*10**6)-(r4*10**3))*10**-3 #in kohm\n", + "r2=(((v4/v2)*x*10**6)-((r4+r3)*10**3))*10**-3 # in kohm\n", + "r1=9*10**6-((r2+r3+r4)*10**3) # in ohm\n", + "r1*=10**-6 # Mohm\n", + "print \"Resistance, R4 is \",round(r4,2),\" kohm.\"\n", + "print \"Resistance, R3 is \",round(r3,2),\" kohm.\"\n", + "print \"Resistance, R2 is \",r2,\" kohm.\"\n", + "print \"Resistance, R1 is \",r1,\" Mohm.\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Resistance, R4 is 87.38 kohm.\n", + "Resistance, R3 is 2.62 kohm.\n", + "Resistance, R2 is 210.0 kohm.\n", + "Resistance, R1 is 8.7 Mohm.\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.19.4 - page : 4-51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Current\n", + "#given data :\n", + "rd=150.0*10**3 # in ohm\n", + "Rm=50.0 # in ohm\n", + "Rs=1000.0*10**3 # in ohm\n", + "gm=0.0052 #in mho\n", + "rd1=rd/((gm*rd)+1) \n", + "V0=gm*((rd1*Rs)/(rd1+Rs))\n", + "R0=(2*Rs*rd1)/(Rs+rd1)\n", + "I=V0/(R0+Rm) # A\n", + "I*=10**3 # mA\n", + "print \"Curent, I = \", round(I,3),\" mA\"\n", + "# Answer in the textbook is not accurate." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Curent, I = 2.3 mA\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.19.5 - page : 4-52" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Resistance\n", + "#given data :\n", + "V1=1.0 #in V\n", + "I=1.5*10**-3 #in A\n", + "rd=200.0*10**3 # in ohm\n", + "Rm=50.0 # in ohm\n", + "Rs=600.0*10**3 # in ohm\n", + "gm=0.005 #in mho\n", + "rd1=rd/((gm*rd)+1) \n", + "V0=gm*((rd1*Rs)/(rd1+Rs))*V1\n", + "R0=(2*Rs*rd1)/(Rs+rd1)\n", + "R_cal=(V0/I)-Rm-R0 \n", + "print \"Resistance , R_cal = \",round(R_cal,2),\" ohm\" \n", + "# answer is wrong in book" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Resistance , R_cal = 216.31 ohm\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example q.3 - page : 4-73" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Current and voltage\n", + "rm=10.0 #in ohm\n", + "im=5.0 # in mA\n", + "i=1.0 # in A\n", + "v=5.0 #in A\n", + "ish=i-(im*10**-3) # in A\n", + "m=i/(im*10**-3) # ratio\n", + "rsh=rm/(m-1) #in ohm\n", + "vo=v/i #in V\n", + "rsh1=vo/(im) #in kohm\n", + "print \"Shunt resistance is \",round(rsh,2),\" ohm to measure current upto 1 A\"\n", + "print \"Shunt resistance is \", rsh1,\" kohm to measure voltage upto 5 V\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Shunt resistance is 0.05 ohm to measure current upto 1 A\n", + "Shunt resistance is 1.0 kohm to measure voltage upto 5 V\n" + ] + } + ], + "prompt_number": 30 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file |