diff options
author | hardythe1 | 2015-06-03 15:27:17 +0530 |
---|---|---|
committer | hardythe1 | 2015-06-03 15:27:17 +0530 |
commit | df60071cf1d1c18822d34f943ab8f412a8946b69 (patch) | |
tree | ab059cf19bad4a1233a464ccf5d72cf8b3fb323c /Principles_Of_Electronic_Instrumentation | |
parent | fba055ce5aa0955e22bac2413c33493b10ae6532 (diff) | |
download | Python-Textbook-Companions-df60071cf1d1c18822d34f943ab8f412a8946b69.tar.gz Python-Textbook-Companions-df60071cf1d1c18822d34f943ab8f412a8946b69.tar.bz2 Python-Textbook-Companions-df60071cf1d1c18822d34f943ab8f412a8946b69.zip |
add books
Diffstat (limited to 'Principles_Of_Electronic_Instrumentation')
55 files changed, 20114 insertions, 0 deletions
diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch1.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch1.ipynb new file mode 100755 index 00000000..5c780e84 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch1.ipynb @@ -0,0 +1,404 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 1 : Basic Concepts"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_1,pg 481"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# unknown resistance(refer fig. 1.4(a))\n",
+ "\n",
+ "import math\n",
+ "#VAriable declaration\n",
+ "Ir=10*10**-3 #current drawn by resistor\n",
+ "Vr=100.0 #voltage across resistor\n",
+ "Rv=40*10**3 #voltmeter resistance\n",
+ "\n",
+ "#Calcualtions\n",
+ "Ru=(Vr/Ir)*(1/(1-(Vr/(Ir*Rv)))) \n",
+ "\n",
+ "#Result\n",
+ "print(\"output resistance:\")\n",
+ "print(\"Ru = %d ohm\"%Ru)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output resistance:\n",
+ "Ru = 13333 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_2,pg 481"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# unknown resistance(refer fig. 1.4(b))\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Ir=10*10**-3 #current drawn by resistor\n",
+ "Vr=100.0 #voltage across resistor\n",
+ "Rv=40*10**3 #voltmeter resistance\n",
+ "Ra=1.0 #ammeter resistance\n",
+ "\n",
+ "#Calculations\n",
+ "Ru=(Rv/Ir)-Ra\n",
+ "\n",
+ "#Result\n",
+ "print(\"output resistance:\")\n",
+ "print(\"Ru = %.2f ohm\"%Ru)\n",
+ "# Answer in the book is in k-ohm"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output resistance:\n",
+ "Ru=3999999.00 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_3,pg 481"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find ammeter reading\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Rv=40*10**3 #voltmeter resistance\n",
+ "Ra=1.0 #ammeter resistance\n",
+ "Vr=40.0 #voltmeter reading\n",
+ "Ru=10*10**3 #unknown resistance\n",
+ "\n",
+ "#Calculations\n",
+ "Ir=(Vr*(Rv+Ru))/(Ru*Rv)\n",
+ "Ir1=(Vr/(Ru+Ra))\n",
+ "\n",
+ "#Result\n",
+ "print(\"ammeter reading case1:\")\n",
+ "print(\"Ir = %d mA\"%(Ir*10**3))\n",
+ "print(\"\\nammeter reading case2:\")\n",
+ "print(\"Ir1 = %.d mA\"%(Ir1*10**3))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "ammeter reading case1:\n",
+ "Ir = 5 mA\n",
+ "\n",
+ "ammeter reading case2:\n",
+ "Ir1 = 3 mA\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_4,pg 482"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# unknown resistance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vs=3.0 #supply voltage\n",
+ "Vu=2.75 #voltmeter reading\n",
+ "Rp=10*10**3 #parallel resistance\n",
+ "\n",
+ "#Calculations\n",
+ "Ru=Rp*((Vs/Vu)-1)\n",
+ "\n",
+ "#Result\n",
+ "print(\"unknown resistance:\")\n",
+ "print(\"Ru = %.2f ohm\"%Ru)\n",
+ "#Answer in the book is not matching"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "unknown resistance:\n",
+ "Ru=909.09 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_5,pg 482"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Find input vlotage\n",
+ "\n",
+ "#with input voltage exceding 2Vd,diodes conduct and the voltage divider circuit with diodes can allow only a Vi given by Vi=2Vd\n",
+ "\n",
+ "#Result\n",
+ "print(\"input voltage to amplifier:\")\n",
+ "print(\"Vi = 2*Vd\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "input voltage to amplifier:\n",
+ "Vi = 2*Vd\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_6,pg 482"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find shunt resistance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Rm=1000.0 #meter resistance\n",
+ "Is=900*10**-6 #shunt current\n",
+ "Vm=100*10**-3 #drop across meter\n",
+ "\n",
+ "#Result\n",
+ "Rs=Vm/Is\n",
+ "It=1*10**-3\n",
+ "#Is=It*(Rm/(Rs+Rm))\n",
+ "Rs=(Rm*(It-Is))/Is\n",
+ "\n",
+ "#Result\n",
+ "print(\"shunt resistance:\")\n",
+ "print(\"Rs = %.1f ohm\"%Rs)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "shunt resistance:\n",
+ "Rs = 111.1 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_7,pg 483"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find series resistor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "If=100*10**-6 #full scale current\n",
+ "Rm=1000.0 #meter resistance\n",
+ "Vf=10.0 #full scale voltage\n",
+ "\n",
+ "#Calculations\n",
+ "Rs=(Vf/If)-Rm\n",
+ "\n",
+ "#Result\n",
+ "print(\"series resistance:\")\n",
+ "print(\"Rs=%.0f ohm\"%Rs)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "series resistance:\n",
+ "Rs=99000 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_8,pg 483"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# sensitivity\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "If=100*10**-6 # Current\n",
+ "\n",
+ "#Calculations\n",
+ "S=1/If\n",
+ "\n",
+ "#Result\n",
+ "print(\"sensitivity:\")\n",
+ "print(\"S = %.2f ohm/volt\"%S)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "sensitivity:\n",
+ "S = 10000.00 ohm/volt\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_9,pg 483"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# error in measurment\n",
+ "\n",
+ "import math\n",
+ "# Variable declaration\n",
+ "\n",
+ "#assume that the voltmeter full scale reading is 12V which gives its resistance as 1.2*10^6 ohm \n",
+ "#which is in parallel with 10*10^6 ohm making as equivalent of Rq given as\n",
+ "R=1.2*10**6 #voltmeter resistance\n",
+ "R1=10*10**6 #voltage divider resistance\n",
+ "Vin=12.0 #input voltage to divider network\n",
+ "Rs=4*10**6 # series resistance\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "Rq=(R*R1)/(R+R1)\n",
+ "Vq=(Rq*Vin)/(Rq+Rs) #voltage across equivalent combination\n",
+ "Va=(R1*Vin)/(R1+Rs) #actual volatge\n",
+ "er=(Vq-Va)/Va #error\n",
+ "\n",
+ "#Result\n",
+ "print(\"error in measurement:\")\n",
+ "print(\"\\ner = %.3f i.e %.1f%%\"%(er,er*100))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "error in measurement:\n",
+ "\n",
+ "er = -0.704 i.e -70.4%\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch10.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch10.ipynb new file mode 100755 index 00000000..47581a84 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch10.ipynb @@ -0,0 +1,671 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 10 : Bridge Circuits"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_1,pg 292"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# wheatstone bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vs=12.0 #source voltage\n",
+ "R=120.0 #resistance of arms \n",
+ "delv=0.3 #variation in output voltage(+/-)0.3\n",
+ "Rm=100.0 #meter resistance\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "delRbyR=(4.0/Vs)*(delv)*100\n",
+ "delIm=(delRbyR/100.0)/(4.0*R*(1+(Rm/R)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"percent change in resistance:\")\n",
+ "print(\"delRbyR = %.f%% \\n\"%delRbyR)\n",
+ "print(\"current variation:\")\n",
+ "print(\"delIm = %.6f A\"%delIm)\n",
+ "# Answer current variation is not matchhing with the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "percent change in resistance:\n",
+ "delRbyR = 10% \n",
+ "\n",
+ "current variation:\n",
+ "delIm = 0.000114 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_2,pg 295"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# high resistance measurement bridge\n",
+ "\n",
+ "import math\n",
+ "#variable declaration\n",
+ "#in absence of the guard point arrangement, two 10^10 ohm resistances in series become parallel \n",
+ "#to the 10^9 ohm resistance, making the effective unknown resistance\n",
+ "\n",
+ "#case-1\n",
+ "Rh=10.0**9\n",
+ "Ra1=10.0**10\n",
+ "Rb1=10.0**10\n",
+ "#case-2 \n",
+ "Ra2=10.0**9\n",
+ "Rb2=10.0**9\n",
+ "\n",
+ "#Calculations\n",
+ "Rue1=((Rh*2*Ra1)/(Rh+(2*Ra1))) #effective resistance\n",
+ "err1=((Rh-Rue1)/Rh)*100 #percentage error\n",
+ "Rue2=((Rh*2*Ra2)/(Rh+(2*Ra2))) #effective resistance\n",
+ "err2=((Rh-Rue2)/Rh)*100 #percentage error\n",
+ "\n",
+ "#Result\n",
+ "print(\"percentage error case-1:\")\n",
+ "print(\"err1 = %.0f%% \\n\"%err1)\n",
+ "print(\"percentage error case-2:\")\n",
+ "print(\"err2 = %.1f%%\"%err2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "percentage error case-1:\n",
+ "err1 = 5% \n",
+ "\n",
+ "percentage error case-2:\n",
+ "err2 = 33.3%\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_3,pg 297"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# capacitance and resistance of AC bridge\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Z1=20.0+80.0j #impedance in first arm\n",
+ "Z2=200.0 #impedance in second arm\n",
+ "Z3=100.0+200.0j #impedance in third arm\n",
+ "f=50.0 #excitation frequency\n",
+ "\n",
+ "#Calculations\n",
+ "Zu=((Z2*Z3)/Z1) #impedance of fourth arm\n",
+ "Cu=(1.0/(2*math.pi*f*Zu.real)) #capacitance in fourth arm\n",
+ "Ru=-Zu.imag #resistance in fourth arm\n",
+ "\n",
+ "#Result\n",
+ "print(\"capacitance in fourth arm:\")\n",
+ "print(\"Cu = %f F\\n\"%(Cu*10**6))\n",
+ "print(\"resistance in fourth arm:\")\n",
+ "print(\"Ru = %.2f ohm\"%Ru)\n",
+ "#Answer is slightly different than book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "capacitance in fourth arm:\n",
+ "Cu = 6.012520 F\n",
+ "\n",
+ "resistance in fourth arm:\n",
+ "Ru = 117.65 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_4,pg 301"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# schering bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "C3=0.001*10**-6 #capacitor\n",
+ "Fd=6.0*10**-4 #dissipation factor\n",
+ "f=1.0*10**3 #schering bridge frequency\n",
+ "R1=10.0*10**3\n",
+ "R2=10.0*10**3\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "Ru=(Fd/(2*math.pi*f*C3)) #standard resistor\n",
+ "C1=C3*(1/R2)*Ru\n",
+ "\n",
+ "#Result\n",
+ "print(\"standard resistor:\")\n",
+ "print(\"Ru = %.3f ohm\\n\"%Ru)\n",
+ "print(\"capacitor:\")\n",
+ "print(\"C1 = %.1f pF\"%(C1*10**12))\n",
+ "#Answer do not match with the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "standard resistor:\n",
+ "Ru = 95.493 ohm\n",
+ "\n",
+ "capacitor:\n",
+ "C1 = 9.5 pF\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_5,pg 303"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# wein bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R=10*10**3 #resistor\n",
+ "C=0.001*10**-6 #capacitor\n",
+ "R3=10.0*10**3 #reistance in third arm\n",
+ "\n",
+ "#Calculations\n",
+ "f=(1.0/(2*math.pi*R*C)) #supply frequency\n",
+ "R4=(R3/2) #reistance in fourth arm\n",
+ "\n",
+ "#Result\n",
+ "print(\"supply frequency:\")\n",
+ "print(\"f = %.2f kHz\\n\"%(f/1000))\n",
+ "print(\"reistance in fourth arm:\")\n",
+ "print(\"R4 = %.1f k-ohm\"%(R4/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "supply frequency:\n",
+ "f = 15.92 kHz\n",
+ "\n",
+ "reistance in fourth arm:\n",
+ "R4 = 5.0 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_6,pg 303"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# balance condition in wein bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "f=47.76*10**3 #supplu frequency\n",
+ "C=10**-9 #assume\n",
+ "\n",
+ "#Calculations\n",
+ "CR=(1.0/(2*math.pi*f)) #resistor capacitor product\n",
+ "R=(CR/C) #resistor\n",
+ "\n",
+ "#Result\n",
+ "print(\"for (R3/R4) = 2\\nR3 and R4 may be maintained at earlier values\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "for (R3/R4) = 2\n",
+ "R3 and R4 may be maintained at earlier values\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_7,pg 309"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# relation between Vo and t for Vi given\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "a1=3.81*10**-3\n",
+ "a2=-6.17*10**-7\n",
+ "#R1=(R2/2),i.e R2/R1=2\n",
+ "R1=10*10**3\n",
+ "R2=20*10**3\n",
+ "R5=4*10**3\n",
+ "R6=20*10**3\n",
+ "\n",
+ "#Calculations\n",
+ "B=(R5/(R5+R6))\n",
+ "#using relation 10.68(b)\n",
+ "\n",
+ "#Result\n",
+ "print(\"(Vo/Vi)= (-3.05*10^-3)t/(1+0.76*10^-3)t\")\n",
+ "print(\"thus for, t<=130 C, Vo is approx. linear. This however can be extended with proper choice\")\n",
+ "print(\"i.e R5 and R6 in relation to R1,R3 and R4\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(Vo/Vi)= (-3.05*10^-3)t/(1+0.76*10^-3)t\n",
+ "thus for, t<=130 C, Vo is approx. linear. This however can be extended with proper choice\n",
+ "i.e R5 and R6 in relation to R1,R3 and R4\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_8,pg 503"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find deflection in galvanometer\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R1=120.0 #resistance of arm-1\n",
+ "R2=120.0 #resistance of arm-2\n",
+ "R3=120.0 #resistance of arm-3\n",
+ "R4=121.0 #resistance of arm-4\n",
+ "Rm=100.0 #meter resistance\n",
+ "Vs=6.0 #source voltage\n",
+ "n=1*10**-3 #meter sensitivity\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "k=(R3/(R3+R4))\n",
+ "k = math.floor(k*10**3)/10**3\n",
+ "Vm=Vs*((R1/(R1+R2))-k) #voltage across meter\n",
+ "Rb=((R1*R2)/(R1+R2))+((R3*R4)/(R3+R4)) #thevenised bridge resistance\n",
+ "Rb=math.floor(Rb*1000)/1000 \n",
+ "Ig=(Vm/(Rb+Rm)) #current through galvanometer\n",
+ " \n",
+ "D=Ig*10**6\n",
+ "\n",
+ "#Result\n",
+ "print(\"deflection in meter:\")\n",
+ "print(\"D = %f mm\"%D)\n",
+ "#Calcualtions in the book are not correct"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "deflection in meter:\n",
+ "D = 81.726054 mm\n"
+ ]
+ }
+ ],
+ "prompt_number": 49
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_9,pg 503"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find insulating post resistance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "err=0.5/100.0 #(+/-)0.5%\n",
+ "R=100.0*10**6 #test resistance\n",
+ "\n",
+ "#Calculations\n",
+ "#Re=((R*2*Rip)/(R+(2*Rip)))\n",
+ "Re1=R-(err*R) #err=+0.5\n",
+ "Re2=R+(err*R) #err=-0.5\n",
+ "Rip1=((R*Re1)/(2*(R-Re1))) #err=+0.5\n",
+ "Rip2=((R*Re2)/(2*(Re2-R))) #err=-0.5\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print(\"resistance of each insulating post-1:\")\n",
+ "print(\"Rip1 = %.2f M-ohm\\n\"%(Rip1*10**-6))\n",
+ "print(\"resistance of each insulating post-2:\")\n",
+ "print(\"Rip2 = %.2f M-ohm\"%(Rip2*10**-6))\n",
+ "# Answer in the book are not matching"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "resistance of each insulating post-1:\n",
+ "Rip1 = 9950.00 M-ohm\n",
+ "\n",
+ "resistance of each insulating post-2:\n",
+ "Rip2 = 10050.00 M-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 61
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_10,pg 504\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# maxwell bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Ru=130.0 #resistance\n",
+ "Lu=31*10**-3 #inductance \n",
+ "R2=10*10**3 #resistance in arm-2\n",
+ "C1=0.01*10**-6 #capacitance in arm\n",
+ "\n",
+ "#Calculations\n",
+ "R3=(Lu/(C1*R2)) #resistance in arm-3\n",
+ "R1=((R2*R3)/Ru) #resistance in arm-1\n",
+ "\n",
+ "#Result\n",
+ "print(\"R1 = %.2f k-ohm\"%(R1/1000))\n",
+ "print(\"R3 = %.f ohm\"%R3)\n",
+ "print(\"yes values are unique\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "R1 = 23.85 k-ohm\n",
+ "R3 = 310 ohm\n",
+ "yes values are unique\n"
+ ]
+ }
+ ],
+ "prompt_number": 64
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_11,pg 504"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# hay bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "f=1000.0 #supply frequency\n",
+ "C1=0.04*10**-6 #capacitance\n",
+ "R1=220.0 #resistance in arm-1\n",
+ "R2 = 10*10**3 #resistance in arm-2\n",
+ "Lu=22.0*10**-3 #inductance\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "pi= math.floor(math.pi*100)/100\n",
+ "Ru=((2*pi*f)**2)*C1*R1*Lu #resistance\n",
+ "R3=((R1*Ru)+(Lu/C1))/R2 #resistance in arm-3\n",
+ "\n",
+ "#Result\n",
+ "print(\"resistance of inductor:\")\n",
+ "print(\"Ru = %.3f ohm\\n\"%Ru)\n",
+ "print(\"resistance of arm-3:\")\n",
+ "print(\"R3 = %.2f ohm\"%R3)\n",
+ "#Answer for R3 is not matching."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "resistance of inductor:\n",
+ "Ru = 7.635 ohm\n",
+ "\n",
+ "resistance of arm-3:\n",
+ "R3 = 55.17 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 74
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_12,pg 505"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find C1 C3 and dissipation factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "C4=0.0033*10**-6 #lossy capacitor\n",
+ "R2=12.0*10**3 #arm-2 resistance\n",
+ "R1=10.0*10**3 #arm-1 resistance\n",
+ "f = 50.0 # frequency\n",
+ "\n",
+ "#Calculations\n",
+ "C3=((C4*R2)/R1) #standard capacitance\n",
+ "R4=0.1\n",
+ "C1=((R4*C3)/R2)\n",
+ "Fd=2*math.pi*f*C4*R4 #dissipation factor\n",
+ "\n",
+ "#Result\n",
+ "print(\"capacitance set value:\")\n",
+ "print(\"C1 = %.5f * 10^12 F\\n\"%(C1*10**12))\n",
+ "print(\"value of standard capacitance:\")\n",
+ "print(\"C3 = %.5f *10^6 F\\n\"%(C3*10**6))\n",
+ "print(\"dissipation factor:\")\n",
+ "print(\"Fd = %.4f * 10^-6\"%(math.floor(Fd*10**10)/10**4))\n",
+ "#Answer for C1 is wrong"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "capacitance set value:\n",
+ "C1 = 0.03300 * 10^12 F\n",
+ "\n",
+ "value of standard capacitance:\n",
+ "C3 = 0.00396 *10^6 F\n",
+ "\n",
+ "dissipation factor:\n",
+ "Fd = 0.1036 * 10^-6\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_13,pg 505"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# wein bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "f=10.0*10**3 #supply frequency\n",
+ "R1=10.0*10**3 #reistance of arm-1\n",
+ "C1=0.01*10**-6\n",
+ "C2=0.01*10**-6\n",
+ "R3=20*10**3 #resistance of arm-3\n",
+ "\n",
+ "#Calaculations\n",
+ "R2=(1/(f**2))*(1/(C1*C2*R1)) #resistance of arm-2\n",
+ "R4=(R3/((R1/R2)+(C2/C1))) #resistance of arm-4\n",
+ "\n",
+ "#Result\n",
+ "print(\"resistance of arm-2:\")\n",
+ "print(\"R4 = %.f k-ohm\\n\"%(R2/1000))\n",
+ "print(\"resistance of arm-4:\")\n",
+ "print(\"R2 = %.f k-ohm\\n\"%(R4/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "resistance of arm-2:\n",
+ "R4 = 10 k-ohm\n",
+ "\n",
+ "resistance of arm-4:\n",
+ "R2 = 10 k-ohm\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch10_1.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch10_1.ipynb new file mode 100755 index 00000000..47581a84 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch10_1.ipynb @@ -0,0 +1,671 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 10 : Bridge Circuits"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_1,pg 292"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# wheatstone bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vs=12.0 #source voltage\n",
+ "R=120.0 #resistance of arms \n",
+ "delv=0.3 #variation in output voltage(+/-)0.3\n",
+ "Rm=100.0 #meter resistance\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "delRbyR=(4.0/Vs)*(delv)*100\n",
+ "delIm=(delRbyR/100.0)/(4.0*R*(1+(Rm/R)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"percent change in resistance:\")\n",
+ "print(\"delRbyR = %.f%% \\n\"%delRbyR)\n",
+ "print(\"current variation:\")\n",
+ "print(\"delIm = %.6f A\"%delIm)\n",
+ "# Answer current variation is not matchhing with the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "percent change in resistance:\n",
+ "delRbyR = 10% \n",
+ "\n",
+ "current variation:\n",
+ "delIm = 0.000114 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_2,pg 295"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# high resistance measurement bridge\n",
+ "\n",
+ "import math\n",
+ "#variable declaration\n",
+ "#in absence of the guard point arrangement, two 10^10 ohm resistances in series become parallel \n",
+ "#to the 10^9 ohm resistance, making the effective unknown resistance\n",
+ "\n",
+ "#case-1\n",
+ "Rh=10.0**9\n",
+ "Ra1=10.0**10\n",
+ "Rb1=10.0**10\n",
+ "#case-2 \n",
+ "Ra2=10.0**9\n",
+ "Rb2=10.0**9\n",
+ "\n",
+ "#Calculations\n",
+ "Rue1=((Rh*2*Ra1)/(Rh+(2*Ra1))) #effective resistance\n",
+ "err1=((Rh-Rue1)/Rh)*100 #percentage error\n",
+ "Rue2=((Rh*2*Ra2)/(Rh+(2*Ra2))) #effective resistance\n",
+ "err2=((Rh-Rue2)/Rh)*100 #percentage error\n",
+ "\n",
+ "#Result\n",
+ "print(\"percentage error case-1:\")\n",
+ "print(\"err1 = %.0f%% \\n\"%err1)\n",
+ "print(\"percentage error case-2:\")\n",
+ "print(\"err2 = %.1f%%\"%err2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "percentage error case-1:\n",
+ "err1 = 5% \n",
+ "\n",
+ "percentage error case-2:\n",
+ "err2 = 33.3%\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_3,pg 297"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# capacitance and resistance of AC bridge\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Z1=20.0+80.0j #impedance in first arm\n",
+ "Z2=200.0 #impedance in second arm\n",
+ "Z3=100.0+200.0j #impedance in third arm\n",
+ "f=50.0 #excitation frequency\n",
+ "\n",
+ "#Calculations\n",
+ "Zu=((Z2*Z3)/Z1) #impedance of fourth arm\n",
+ "Cu=(1.0/(2*math.pi*f*Zu.real)) #capacitance in fourth arm\n",
+ "Ru=-Zu.imag #resistance in fourth arm\n",
+ "\n",
+ "#Result\n",
+ "print(\"capacitance in fourth arm:\")\n",
+ "print(\"Cu = %f F\\n\"%(Cu*10**6))\n",
+ "print(\"resistance in fourth arm:\")\n",
+ "print(\"Ru = %.2f ohm\"%Ru)\n",
+ "#Answer is slightly different than book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "capacitance in fourth arm:\n",
+ "Cu = 6.012520 F\n",
+ "\n",
+ "resistance in fourth arm:\n",
+ "Ru = 117.65 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_4,pg 301"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# schering bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "C3=0.001*10**-6 #capacitor\n",
+ "Fd=6.0*10**-4 #dissipation factor\n",
+ "f=1.0*10**3 #schering bridge frequency\n",
+ "R1=10.0*10**3\n",
+ "R2=10.0*10**3\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "Ru=(Fd/(2*math.pi*f*C3)) #standard resistor\n",
+ "C1=C3*(1/R2)*Ru\n",
+ "\n",
+ "#Result\n",
+ "print(\"standard resistor:\")\n",
+ "print(\"Ru = %.3f ohm\\n\"%Ru)\n",
+ "print(\"capacitor:\")\n",
+ "print(\"C1 = %.1f pF\"%(C1*10**12))\n",
+ "#Answer do not match with the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "standard resistor:\n",
+ "Ru = 95.493 ohm\n",
+ "\n",
+ "capacitor:\n",
+ "C1 = 9.5 pF\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_5,pg 303"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# wein bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R=10*10**3 #resistor\n",
+ "C=0.001*10**-6 #capacitor\n",
+ "R3=10.0*10**3 #reistance in third arm\n",
+ "\n",
+ "#Calculations\n",
+ "f=(1.0/(2*math.pi*R*C)) #supply frequency\n",
+ "R4=(R3/2) #reistance in fourth arm\n",
+ "\n",
+ "#Result\n",
+ "print(\"supply frequency:\")\n",
+ "print(\"f = %.2f kHz\\n\"%(f/1000))\n",
+ "print(\"reistance in fourth arm:\")\n",
+ "print(\"R4 = %.1f k-ohm\"%(R4/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "supply frequency:\n",
+ "f = 15.92 kHz\n",
+ "\n",
+ "reistance in fourth arm:\n",
+ "R4 = 5.0 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_6,pg 303"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# balance condition in wein bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "f=47.76*10**3 #supplu frequency\n",
+ "C=10**-9 #assume\n",
+ "\n",
+ "#Calculations\n",
+ "CR=(1.0/(2*math.pi*f)) #resistor capacitor product\n",
+ "R=(CR/C) #resistor\n",
+ "\n",
+ "#Result\n",
+ "print(\"for (R3/R4) = 2\\nR3 and R4 may be maintained at earlier values\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "for (R3/R4) = 2\n",
+ "R3 and R4 may be maintained at earlier values\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_7,pg 309"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# relation between Vo and t for Vi given\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "a1=3.81*10**-3\n",
+ "a2=-6.17*10**-7\n",
+ "#R1=(R2/2),i.e R2/R1=2\n",
+ "R1=10*10**3\n",
+ "R2=20*10**3\n",
+ "R5=4*10**3\n",
+ "R6=20*10**3\n",
+ "\n",
+ "#Calculations\n",
+ "B=(R5/(R5+R6))\n",
+ "#using relation 10.68(b)\n",
+ "\n",
+ "#Result\n",
+ "print(\"(Vo/Vi)= (-3.05*10^-3)t/(1+0.76*10^-3)t\")\n",
+ "print(\"thus for, t<=130 C, Vo is approx. linear. This however can be extended with proper choice\")\n",
+ "print(\"i.e R5 and R6 in relation to R1,R3 and R4\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(Vo/Vi)= (-3.05*10^-3)t/(1+0.76*10^-3)t\n",
+ "thus for, t<=130 C, Vo is approx. linear. This however can be extended with proper choice\n",
+ "i.e R5 and R6 in relation to R1,R3 and R4\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_8,pg 503"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find deflection in galvanometer\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R1=120.0 #resistance of arm-1\n",
+ "R2=120.0 #resistance of arm-2\n",
+ "R3=120.0 #resistance of arm-3\n",
+ "R4=121.0 #resistance of arm-4\n",
+ "Rm=100.0 #meter resistance\n",
+ "Vs=6.0 #source voltage\n",
+ "n=1*10**-3 #meter sensitivity\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "k=(R3/(R3+R4))\n",
+ "k = math.floor(k*10**3)/10**3\n",
+ "Vm=Vs*((R1/(R1+R2))-k) #voltage across meter\n",
+ "Rb=((R1*R2)/(R1+R2))+((R3*R4)/(R3+R4)) #thevenised bridge resistance\n",
+ "Rb=math.floor(Rb*1000)/1000 \n",
+ "Ig=(Vm/(Rb+Rm)) #current through galvanometer\n",
+ " \n",
+ "D=Ig*10**6\n",
+ "\n",
+ "#Result\n",
+ "print(\"deflection in meter:\")\n",
+ "print(\"D = %f mm\"%D)\n",
+ "#Calcualtions in the book are not correct"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "deflection in meter:\n",
+ "D = 81.726054 mm\n"
+ ]
+ }
+ ],
+ "prompt_number": 49
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_9,pg 503"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find insulating post resistance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "err=0.5/100.0 #(+/-)0.5%\n",
+ "R=100.0*10**6 #test resistance\n",
+ "\n",
+ "#Calculations\n",
+ "#Re=((R*2*Rip)/(R+(2*Rip)))\n",
+ "Re1=R-(err*R) #err=+0.5\n",
+ "Re2=R+(err*R) #err=-0.5\n",
+ "Rip1=((R*Re1)/(2*(R-Re1))) #err=+0.5\n",
+ "Rip2=((R*Re2)/(2*(Re2-R))) #err=-0.5\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print(\"resistance of each insulating post-1:\")\n",
+ "print(\"Rip1 = %.2f M-ohm\\n\"%(Rip1*10**-6))\n",
+ "print(\"resistance of each insulating post-2:\")\n",
+ "print(\"Rip2 = %.2f M-ohm\"%(Rip2*10**-6))\n",
+ "# Answer in the book are not matching"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "resistance of each insulating post-1:\n",
+ "Rip1 = 9950.00 M-ohm\n",
+ "\n",
+ "resistance of each insulating post-2:\n",
+ "Rip2 = 10050.00 M-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 61
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_10,pg 504\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# maxwell bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Ru=130.0 #resistance\n",
+ "Lu=31*10**-3 #inductance \n",
+ "R2=10*10**3 #resistance in arm-2\n",
+ "C1=0.01*10**-6 #capacitance in arm\n",
+ "\n",
+ "#Calculations\n",
+ "R3=(Lu/(C1*R2)) #resistance in arm-3\n",
+ "R1=((R2*R3)/Ru) #resistance in arm-1\n",
+ "\n",
+ "#Result\n",
+ "print(\"R1 = %.2f k-ohm\"%(R1/1000))\n",
+ "print(\"R3 = %.f ohm\"%R3)\n",
+ "print(\"yes values are unique\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "R1 = 23.85 k-ohm\n",
+ "R3 = 310 ohm\n",
+ "yes values are unique\n"
+ ]
+ }
+ ],
+ "prompt_number": 64
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_11,pg 504"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# hay bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "f=1000.0 #supply frequency\n",
+ "C1=0.04*10**-6 #capacitance\n",
+ "R1=220.0 #resistance in arm-1\n",
+ "R2 = 10*10**3 #resistance in arm-2\n",
+ "Lu=22.0*10**-3 #inductance\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "pi= math.floor(math.pi*100)/100\n",
+ "Ru=((2*pi*f)**2)*C1*R1*Lu #resistance\n",
+ "R3=((R1*Ru)+(Lu/C1))/R2 #resistance in arm-3\n",
+ "\n",
+ "#Result\n",
+ "print(\"resistance of inductor:\")\n",
+ "print(\"Ru = %.3f ohm\\n\"%Ru)\n",
+ "print(\"resistance of arm-3:\")\n",
+ "print(\"R3 = %.2f ohm\"%R3)\n",
+ "#Answer for R3 is not matching."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "resistance of inductor:\n",
+ "Ru = 7.635 ohm\n",
+ "\n",
+ "resistance of arm-3:\n",
+ "R3 = 55.17 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 74
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_12,pg 505"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find C1 C3 and dissipation factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "C4=0.0033*10**-6 #lossy capacitor\n",
+ "R2=12.0*10**3 #arm-2 resistance\n",
+ "R1=10.0*10**3 #arm-1 resistance\n",
+ "f = 50.0 # frequency\n",
+ "\n",
+ "#Calculations\n",
+ "C3=((C4*R2)/R1) #standard capacitance\n",
+ "R4=0.1\n",
+ "C1=((R4*C3)/R2)\n",
+ "Fd=2*math.pi*f*C4*R4 #dissipation factor\n",
+ "\n",
+ "#Result\n",
+ "print(\"capacitance set value:\")\n",
+ "print(\"C1 = %.5f * 10^12 F\\n\"%(C1*10**12))\n",
+ "print(\"value of standard capacitance:\")\n",
+ "print(\"C3 = %.5f *10^6 F\\n\"%(C3*10**6))\n",
+ "print(\"dissipation factor:\")\n",
+ "print(\"Fd = %.4f * 10^-6\"%(math.floor(Fd*10**10)/10**4))\n",
+ "#Answer for C1 is wrong"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "capacitance set value:\n",
+ "C1 = 0.03300 * 10^12 F\n",
+ "\n",
+ "value of standard capacitance:\n",
+ "C3 = 0.00396 *10^6 F\n",
+ "\n",
+ "dissipation factor:\n",
+ "Fd = 0.1036 * 10^-6\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_13,pg 505"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# wein bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "f=10.0*10**3 #supply frequency\n",
+ "R1=10.0*10**3 #reistance of arm-1\n",
+ "C1=0.01*10**-6\n",
+ "C2=0.01*10**-6\n",
+ "R3=20*10**3 #resistance of arm-3\n",
+ "\n",
+ "#Calaculations\n",
+ "R2=(1/(f**2))*(1/(C1*C2*R1)) #resistance of arm-2\n",
+ "R4=(R3/((R1/R2)+(C2/C1))) #resistance of arm-4\n",
+ "\n",
+ "#Result\n",
+ "print(\"resistance of arm-2:\")\n",
+ "print(\"R4 = %.f k-ohm\\n\"%(R2/1000))\n",
+ "print(\"resistance of arm-4:\")\n",
+ "print(\"R2 = %.f k-ohm\\n\"%(R4/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "resistance of arm-2:\n",
+ "R4 = 10 k-ohm\n",
+ "\n",
+ "resistance of arm-4:\n",
+ "R2 = 10 k-ohm\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch10_2.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch10_2.ipynb new file mode 100755 index 00000000..47581a84 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch10_2.ipynb @@ -0,0 +1,671 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 10 : Bridge Circuits"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_1,pg 292"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# wheatstone bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vs=12.0 #source voltage\n",
+ "R=120.0 #resistance of arms \n",
+ "delv=0.3 #variation in output voltage(+/-)0.3\n",
+ "Rm=100.0 #meter resistance\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "delRbyR=(4.0/Vs)*(delv)*100\n",
+ "delIm=(delRbyR/100.0)/(4.0*R*(1+(Rm/R)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"percent change in resistance:\")\n",
+ "print(\"delRbyR = %.f%% \\n\"%delRbyR)\n",
+ "print(\"current variation:\")\n",
+ "print(\"delIm = %.6f A\"%delIm)\n",
+ "# Answer current variation is not matchhing with the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "percent change in resistance:\n",
+ "delRbyR = 10% \n",
+ "\n",
+ "current variation:\n",
+ "delIm = 0.000114 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_2,pg 295"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# high resistance measurement bridge\n",
+ "\n",
+ "import math\n",
+ "#variable declaration\n",
+ "#in absence of the guard point arrangement, two 10^10 ohm resistances in series become parallel \n",
+ "#to the 10^9 ohm resistance, making the effective unknown resistance\n",
+ "\n",
+ "#case-1\n",
+ "Rh=10.0**9\n",
+ "Ra1=10.0**10\n",
+ "Rb1=10.0**10\n",
+ "#case-2 \n",
+ "Ra2=10.0**9\n",
+ "Rb2=10.0**9\n",
+ "\n",
+ "#Calculations\n",
+ "Rue1=((Rh*2*Ra1)/(Rh+(2*Ra1))) #effective resistance\n",
+ "err1=((Rh-Rue1)/Rh)*100 #percentage error\n",
+ "Rue2=((Rh*2*Ra2)/(Rh+(2*Ra2))) #effective resistance\n",
+ "err2=((Rh-Rue2)/Rh)*100 #percentage error\n",
+ "\n",
+ "#Result\n",
+ "print(\"percentage error case-1:\")\n",
+ "print(\"err1 = %.0f%% \\n\"%err1)\n",
+ "print(\"percentage error case-2:\")\n",
+ "print(\"err2 = %.1f%%\"%err2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "percentage error case-1:\n",
+ "err1 = 5% \n",
+ "\n",
+ "percentage error case-2:\n",
+ "err2 = 33.3%\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_3,pg 297"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# capacitance and resistance of AC bridge\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Z1=20.0+80.0j #impedance in first arm\n",
+ "Z2=200.0 #impedance in second arm\n",
+ "Z3=100.0+200.0j #impedance in third arm\n",
+ "f=50.0 #excitation frequency\n",
+ "\n",
+ "#Calculations\n",
+ "Zu=((Z2*Z3)/Z1) #impedance of fourth arm\n",
+ "Cu=(1.0/(2*math.pi*f*Zu.real)) #capacitance in fourth arm\n",
+ "Ru=-Zu.imag #resistance in fourth arm\n",
+ "\n",
+ "#Result\n",
+ "print(\"capacitance in fourth arm:\")\n",
+ "print(\"Cu = %f F\\n\"%(Cu*10**6))\n",
+ "print(\"resistance in fourth arm:\")\n",
+ "print(\"Ru = %.2f ohm\"%Ru)\n",
+ "#Answer is slightly different than book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "capacitance in fourth arm:\n",
+ "Cu = 6.012520 F\n",
+ "\n",
+ "resistance in fourth arm:\n",
+ "Ru = 117.65 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_4,pg 301"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# schering bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "C3=0.001*10**-6 #capacitor\n",
+ "Fd=6.0*10**-4 #dissipation factor\n",
+ "f=1.0*10**3 #schering bridge frequency\n",
+ "R1=10.0*10**3\n",
+ "R2=10.0*10**3\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "Ru=(Fd/(2*math.pi*f*C3)) #standard resistor\n",
+ "C1=C3*(1/R2)*Ru\n",
+ "\n",
+ "#Result\n",
+ "print(\"standard resistor:\")\n",
+ "print(\"Ru = %.3f ohm\\n\"%Ru)\n",
+ "print(\"capacitor:\")\n",
+ "print(\"C1 = %.1f pF\"%(C1*10**12))\n",
+ "#Answer do not match with the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "standard resistor:\n",
+ "Ru = 95.493 ohm\n",
+ "\n",
+ "capacitor:\n",
+ "C1 = 9.5 pF\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_5,pg 303"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# wein bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R=10*10**3 #resistor\n",
+ "C=0.001*10**-6 #capacitor\n",
+ "R3=10.0*10**3 #reistance in third arm\n",
+ "\n",
+ "#Calculations\n",
+ "f=(1.0/(2*math.pi*R*C)) #supply frequency\n",
+ "R4=(R3/2) #reistance in fourth arm\n",
+ "\n",
+ "#Result\n",
+ "print(\"supply frequency:\")\n",
+ "print(\"f = %.2f kHz\\n\"%(f/1000))\n",
+ "print(\"reistance in fourth arm:\")\n",
+ "print(\"R4 = %.1f k-ohm\"%(R4/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "supply frequency:\n",
+ "f = 15.92 kHz\n",
+ "\n",
+ "reistance in fourth arm:\n",
+ "R4 = 5.0 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_6,pg 303"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# balance condition in wein bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "f=47.76*10**3 #supplu frequency\n",
+ "C=10**-9 #assume\n",
+ "\n",
+ "#Calculations\n",
+ "CR=(1.0/(2*math.pi*f)) #resistor capacitor product\n",
+ "R=(CR/C) #resistor\n",
+ "\n",
+ "#Result\n",
+ "print(\"for (R3/R4) = 2\\nR3 and R4 may be maintained at earlier values\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "for (R3/R4) = 2\n",
+ "R3 and R4 may be maintained at earlier values\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_7,pg 309"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# relation between Vo and t for Vi given\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "a1=3.81*10**-3\n",
+ "a2=-6.17*10**-7\n",
+ "#R1=(R2/2),i.e R2/R1=2\n",
+ "R1=10*10**3\n",
+ "R2=20*10**3\n",
+ "R5=4*10**3\n",
+ "R6=20*10**3\n",
+ "\n",
+ "#Calculations\n",
+ "B=(R5/(R5+R6))\n",
+ "#using relation 10.68(b)\n",
+ "\n",
+ "#Result\n",
+ "print(\"(Vo/Vi)= (-3.05*10^-3)t/(1+0.76*10^-3)t\")\n",
+ "print(\"thus for, t<=130 C, Vo is approx. linear. This however can be extended with proper choice\")\n",
+ "print(\"i.e R5 and R6 in relation to R1,R3 and R4\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(Vo/Vi)= (-3.05*10^-3)t/(1+0.76*10^-3)t\n",
+ "thus for, t<=130 C, Vo is approx. linear. This however can be extended with proper choice\n",
+ "i.e R5 and R6 in relation to R1,R3 and R4\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_8,pg 503"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find deflection in galvanometer\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R1=120.0 #resistance of arm-1\n",
+ "R2=120.0 #resistance of arm-2\n",
+ "R3=120.0 #resistance of arm-3\n",
+ "R4=121.0 #resistance of arm-4\n",
+ "Rm=100.0 #meter resistance\n",
+ "Vs=6.0 #source voltage\n",
+ "n=1*10**-3 #meter sensitivity\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "k=(R3/(R3+R4))\n",
+ "k = math.floor(k*10**3)/10**3\n",
+ "Vm=Vs*((R1/(R1+R2))-k) #voltage across meter\n",
+ "Rb=((R1*R2)/(R1+R2))+((R3*R4)/(R3+R4)) #thevenised bridge resistance\n",
+ "Rb=math.floor(Rb*1000)/1000 \n",
+ "Ig=(Vm/(Rb+Rm)) #current through galvanometer\n",
+ " \n",
+ "D=Ig*10**6\n",
+ "\n",
+ "#Result\n",
+ "print(\"deflection in meter:\")\n",
+ "print(\"D = %f mm\"%D)\n",
+ "#Calcualtions in the book are not correct"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "deflection in meter:\n",
+ "D = 81.726054 mm\n"
+ ]
+ }
+ ],
+ "prompt_number": 49
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_9,pg 503"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find insulating post resistance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "err=0.5/100.0 #(+/-)0.5%\n",
+ "R=100.0*10**6 #test resistance\n",
+ "\n",
+ "#Calculations\n",
+ "#Re=((R*2*Rip)/(R+(2*Rip)))\n",
+ "Re1=R-(err*R) #err=+0.5\n",
+ "Re2=R+(err*R) #err=-0.5\n",
+ "Rip1=((R*Re1)/(2*(R-Re1))) #err=+0.5\n",
+ "Rip2=((R*Re2)/(2*(Re2-R))) #err=-0.5\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print(\"resistance of each insulating post-1:\")\n",
+ "print(\"Rip1 = %.2f M-ohm\\n\"%(Rip1*10**-6))\n",
+ "print(\"resistance of each insulating post-2:\")\n",
+ "print(\"Rip2 = %.2f M-ohm\"%(Rip2*10**-6))\n",
+ "# Answer in the book are not matching"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "resistance of each insulating post-1:\n",
+ "Rip1 = 9950.00 M-ohm\n",
+ "\n",
+ "resistance of each insulating post-2:\n",
+ "Rip2 = 10050.00 M-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 61
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_10,pg 504\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# maxwell bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Ru=130.0 #resistance\n",
+ "Lu=31*10**-3 #inductance \n",
+ "R2=10*10**3 #resistance in arm-2\n",
+ "C1=0.01*10**-6 #capacitance in arm\n",
+ "\n",
+ "#Calculations\n",
+ "R3=(Lu/(C1*R2)) #resistance in arm-3\n",
+ "R1=((R2*R3)/Ru) #resistance in arm-1\n",
+ "\n",
+ "#Result\n",
+ "print(\"R1 = %.2f k-ohm\"%(R1/1000))\n",
+ "print(\"R3 = %.f ohm\"%R3)\n",
+ "print(\"yes values are unique\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "R1 = 23.85 k-ohm\n",
+ "R3 = 310 ohm\n",
+ "yes values are unique\n"
+ ]
+ }
+ ],
+ "prompt_number": 64
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_11,pg 504"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# hay bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "f=1000.0 #supply frequency\n",
+ "C1=0.04*10**-6 #capacitance\n",
+ "R1=220.0 #resistance in arm-1\n",
+ "R2 = 10*10**3 #resistance in arm-2\n",
+ "Lu=22.0*10**-3 #inductance\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "pi= math.floor(math.pi*100)/100\n",
+ "Ru=((2*pi*f)**2)*C1*R1*Lu #resistance\n",
+ "R3=((R1*Ru)+(Lu/C1))/R2 #resistance in arm-3\n",
+ "\n",
+ "#Result\n",
+ "print(\"resistance of inductor:\")\n",
+ "print(\"Ru = %.3f ohm\\n\"%Ru)\n",
+ "print(\"resistance of arm-3:\")\n",
+ "print(\"R3 = %.2f ohm\"%R3)\n",
+ "#Answer for R3 is not matching."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "resistance of inductor:\n",
+ "Ru = 7.635 ohm\n",
+ "\n",
+ "resistance of arm-3:\n",
+ "R3 = 55.17 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 74
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_12,pg 505"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find C1 C3 and dissipation factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "C4=0.0033*10**-6 #lossy capacitor\n",
+ "R2=12.0*10**3 #arm-2 resistance\n",
+ "R1=10.0*10**3 #arm-1 resistance\n",
+ "f = 50.0 # frequency\n",
+ "\n",
+ "#Calculations\n",
+ "C3=((C4*R2)/R1) #standard capacitance\n",
+ "R4=0.1\n",
+ "C1=((R4*C3)/R2)\n",
+ "Fd=2*math.pi*f*C4*R4 #dissipation factor\n",
+ "\n",
+ "#Result\n",
+ "print(\"capacitance set value:\")\n",
+ "print(\"C1 = %.5f * 10^12 F\\n\"%(C1*10**12))\n",
+ "print(\"value of standard capacitance:\")\n",
+ "print(\"C3 = %.5f *10^6 F\\n\"%(C3*10**6))\n",
+ "print(\"dissipation factor:\")\n",
+ "print(\"Fd = %.4f * 10^-6\"%(math.floor(Fd*10**10)/10**4))\n",
+ "#Answer for C1 is wrong"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "capacitance set value:\n",
+ "C1 = 0.03300 * 10^12 F\n",
+ "\n",
+ "value of standard capacitance:\n",
+ "C3 = 0.00396 *10^6 F\n",
+ "\n",
+ "dissipation factor:\n",
+ "Fd = 0.1036 * 10^-6\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10_13,pg 505"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# wein bridge\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "f=10.0*10**3 #supply frequency\n",
+ "R1=10.0*10**3 #reistance of arm-1\n",
+ "C1=0.01*10**-6\n",
+ "C2=0.01*10**-6\n",
+ "R3=20*10**3 #resistance of arm-3\n",
+ "\n",
+ "#Calaculations\n",
+ "R2=(1/(f**2))*(1/(C1*C2*R1)) #resistance of arm-2\n",
+ "R4=(R3/((R1/R2)+(C2/C1))) #resistance of arm-4\n",
+ "\n",
+ "#Result\n",
+ "print(\"resistance of arm-2:\")\n",
+ "print(\"R4 = %.f k-ohm\\n\"%(R2/1000))\n",
+ "print(\"resistance of arm-4:\")\n",
+ "print(\"R2 = %.f k-ohm\\n\"%(R4/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "resistance of arm-2:\n",
+ "R4 = 10 k-ohm\n",
+ "\n",
+ "resistance of arm-4:\n",
+ "R2 = 10 k-ohm\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch11.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch11.ipynb new file mode 100755 index 00000000..ad09fffb --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch11.ipynb @@ -0,0 +1,518 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 11 : Test Signal Generation"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_1,pg 343\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# limits of duty cycle\n",
+ "\n",
+ "import math\n",
+ "#Variable decl;aration\n",
+ "R1=1.0*10**3 #input resistance\n",
+ "R2=1.0*10**3 #feedback resistor\n",
+ "R3=1.0*10**3 #non inverting ter. resistor\n",
+ "R8=1.0*10**3 #potentiometer\n",
+ "R4=1.0*10**3\n",
+ "\n",
+ "#Calculations\n",
+ "DF1=(R1/((2*R1)+R8)) #duty factor lim.-1\n",
+ "DF2=(R1+R4)/((2*R1)+R8) #duty factor lim.-2\n",
+ "#T=(((2*R4*C*((2*R1)+R8)))/R1)*(Vt/Vi)=((6*R4*C*Vt)/Vi)\n",
+ "\n",
+ "#Result\n",
+ "print(\"range of duty factor is DF1 to DF2 i.e.\")\n",
+ "print(\"%.2f to %.2f \"%(DF1,DF2))\n",
+ "print(\"\\nlimits of t1 and t2:\")\n",
+ "print(\"(T/3) to (2T/3)\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "range of duty factor is DF1 to DF2 i.e.\n",
+ "0.33 to 0.67 \n",
+ "\n",
+ "limits of t1 and t2:\n",
+ "(T/3) to (2T/3)\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_2,pg 344"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# determine sinewave amplitude and segment slopes\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vtx=5.0 #triangular peak(+/-)5\n",
+ "Vsx=(2/math.pi)*Vtx #sinewave peak\n",
+ "#if n=3 then there are 2*3=6 break points these are at o/p voltages\n",
+ "n=3.0 #break point parameter\n",
+ "\n",
+ "#Calculations\n",
+ "Vs1=(2/math.pi)*Vtx*math.sin((1*math.pi)/((2*n)+1))\n",
+ "Vs2=(2/math.pi)*Vtx*math.sin((2*math.pi)/((2*n)+1))\n",
+ "Vs3=(2/math.pi)*Vtx*math.sin((3*math.pi)/((2*n)+1))\n",
+ "#calculating slopes\n",
+ "ms1=(((2*n)+1)/math.pi)*(math.sin((math.pi*(1+1))/((2*n)+1))-math.sin((math.pi*1)/((2*n)+1)))\n",
+ "ms2=(((2*n)+1)/math.pi)*(math.sin((math.pi*(2+1))/((2*n)+1))-math.sin((math.pi*2)/((2*n)+1)))\n",
+ "ms3=(((2*n)+1)/math.pi)*(math.sin((math.pi*(3+1))/((2*n)+1))-math.sin((math.pi*3)/((2*n)+1)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"break points:\")\n",
+ "print(\"output voltages:\")\n",
+ "print(\"Vs1 = %.2f V \"%Vs1)\n",
+ "print(\"Vs2 = %.2f V \"%Vs2)\n",
+ "print(\"Vs3 = %.2f V\\n\"%Vs3)\n",
+ "print(\"segment slopes:\")\n",
+ "print(\"ms1 = %.2f \"%ms1)\n",
+ "print(\"ms2 = %.2f \"%ms2)\n",
+ "print(\"ms3 = %.2f \"%ms3)\n",
+ "#Answers are slightly different than book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "break points:\n",
+ "output voltages:\n",
+ "Vs1 = 1.38 V \n",
+ "Vs2 = 2.49 V \n",
+ "Vs3 = 3.10 V\n",
+ "\n",
+ "segment slopes:\n",
+ "ms1 = 0.78 \n",
+ "ms2 = 0.43 \n",
+ "ms3 = 0.00 \n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_3,pg 505"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find inductance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R1=0.0 #resistance\n",
+ "C=0.1*10**-6 #capacitance\n",
+ "f=1.0*10**3 #frequency\n",
+ "\n",
+ "#Calculations\n",
+ "L=(1.0/(((2*math.pi*f)**2)*C))\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print(\"Inductance of circuit:\")\n",
+ "print(\"L = %.6f H \"%(L))\n",
+ "#Answer do not matche with book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Inductance of circuit:\n",
+ "L = 0.253303 H \n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_4,pg 506"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# resonance frequency of crystal\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "C1=4*10**-12 #Capacitance\n",
+ "L=94*10**-3 #inductance \n",
+ "C=13*10**-9 #capacitance\n",
+ "R=91.3 #resistance\n",
+ "\n",
+ "#Calculations\n",
+ "f1=(1/(2*math.pi))*((L*C)**(-1.0/2)) #resonance frequency-1\n",
+ "f2=(math.sqrt(1+(C/C1))/(2*math.pi*math.sqrt(L*C))) #resonance frequency-2\n",
+ "\n",
+ "#Result\n",
+ "print(\"resonance frequency-1:\")\n",
+ "print(\"f1 = %.2f kHz\\n\"%(f1/1000))\n",
+ "print(\"resonance frequency-2:\")\n",
+ "print(\"f2 = %.2f kHz\"%(f2/1000))\n",
+ "#Answer for f2 is slightly different"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "resonance frequency-1:\n",
+ "f1 = 4.55 kHz\n",
+ "\n",
+ "resonance frequency-2:\n",
+ "f2 = 259.59 kHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_5,pg 506\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find R in CR section\n",
+ "\n",
+ "import math\n",
+ "#Result\n",
+ "f=1.0*10**3 #frequency\n",
+ "C=0.01*10**-6 #capacitance\n",
+ "\n",
+ "#Calculations\n",
+ "#f=(1/(2*%pi))*(1/(6^(1/2)*RC))\n",
+ "R=(1/(2*math.pi*(6**(0.5)*C*f)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"resistance of circuit\\n\")\n",
+ "print(\"R = %.1f k-ohm\"%(R/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "resistance of circuit\n",
+ "\n",
+ "R = 6.5 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_6,pg 506"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find phase difference in wein network\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "epsi=0.01 #detuning parameter\n",
+ "eta1=1.0 #(f/fo)=1\n",
+ "eta2=2.2 #(f/fo)=2.2\n",
+ "\n",
+ "#Calculations\n",
+ "#case-1\n",
+ "phi1=math.atan((3*eta1*((eta1**2)-1)*(3+(2*epsi)))/((((eta1**2)-1)**2)*(3+epsi)-(9*epsi*(eta1**2))))\n",
+ "#case-2\n",
+ "phi2=math.atan((3*eta2*((eta2**2)-1)*(3+(2*epsi)))/((((eta2**2)-1)**2)*(3+epsi)-(9*epsi*(eta2**2))))\n",
+ "\n",
+ "#Result\n",
+ "print(\"phase difference for case-1:\")\n",
+ "print(\"phi1 = %d rad\\n\"%phi1)\n",
+ "print(\"phase difference for case-2:\")\n",
+ "print(\"phi2 = %.2f rad\"%phi2)\n",
+ "#Answer for phi2 is not matching with book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "phase difference for case-1:\n",
+ "phi1 = 0 rad\n",
+ "\n",
+ "phase difference for case-2:\n",
+ "phi2 = 1.05 rad\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_7,pg 507"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# digital frequency synthesizer\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "N=12.0 #12-bit synthesizer\n",
+ "k1=1.0 #sampling rate at sampler's rate\n",
+ "k2=4.0 #sampling rate at 4 times sampler's rate\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "#case-1\n",
+ "adv1=(360/(2**N)) #advancement of o/p register \n",
+ "#2pi rad=360 deg.\n",
+ "#case-2\n",
+ "adv2=(4.0*(360)/(2**N)) #advancement of o/p register \n",
+ "\n",
+ "#Result\n",
+ "print(\"advancement of o/p register for case-1:\")\n",
+ "print(\"adv1 = %.4f\u00b0 \\n\"%adv1)\n",
+ "print(\"advancement of o/p register for case-2:\")\n",
+ "print(\"adv2 = %.4f\u00b0\"%adv2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "advancement of o/p register for case-1:\n",
+ "adv1 = 0.0879\u00b0 \n",
+ "\n",
+ "advancement of o/p register for case-2:\n",
+ "adv2 = 0.3516\u00b0\n"
+ ]
+ }
+ ],
+ "prompt_number": 31
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_8,pg 507"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find controlling voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "f=1.0*10**3 #frequency\n",
+ "R6=10.0*10**3 #feed-back resistor\n",
+ "R5=22.0*10**3 #feed-in resistor\n",
+ "R4=10.0*10**3 #integrator resistor\n",
+ "C=0.1*10**-6 #integrator capacitor\n",
+ "Vsx=2.0 #comparator pulse amplitude\n",
+ "\n",
+ "#Calculations\n",
+ "Vi=((f*R4*R5*C)/(R6*4*Vsx)) #controlling voltage\n",
+ "\n",
+ "#Result\n",
+ "print(\"controlling voltage:\")\n",
+ "print(\"Vi = %.3f V\"%Vi)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "controlling voltage:\n",
+ "Vi = 0.275 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_9,pg 507"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find limits of duty factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R1=10.0*10**3\n",
+ "R8=10.0*10**3\n",
+ "R4=10.0*10**3\n",
+ "\n",
+ "#Calculations\n",
+ "lim1=(R1/((2*R1)+R8)) #limit-1 of duty factor\n",
+ "lim2=((R1+R4)/((2*R1)+R8)) #limit-2 of duty factor\n",
+ "\n",
+ "#Result\n",
+ "print(\"duty factors are given by (t1/T) and (t2/T). the limits are giiven by\\n\")\n",
+ "print(\"lim1 = %.2f\"%lim1)\n",
+ "print(\"lim2 = %.2f\"%lim2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "duty factors are given by (t1/T) and (t2/T). the limits are giiven by\n",
+ "\n",
+ "lim1 = 0.33\n",
+ "lim2 = 0.67\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_10,pg 507"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find output voltage V1 and V2\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vi=1.3 #input voltage\n",
+ "R2=10.0*10**3\n",
+ "R3=10.0*10**3\n",
+ "R8=10.0*10**3 #potentiometer\n",
+ "B=1.0/3 #wiper distance\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "V1=((R3*Vi)/(R3+(B*R8))) #output voltage-1\n",
+ "V2=-((R2*Vi)/(R3+((1-B)*R8)))#output voltage-2\n",
+ "\n",
+ "#Result\n",
+ "print(\"ouput voltage-1:\")\n",
+ "print(\"V1 = %.4f V\"%V1)\n",
+ "print(\"ouput voltage-2:\")\n",
+ "print(\"V2 = %.4f V\"%V2)\n",
+ "#Answers are slightly different than book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "ouput voltage-1:\n",
+ "V1 = 0.9750 V\n",
+ "ouput voltage-2:\n",
+ "V2 = -0.7800 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 36
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch11_1.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch11_1.ipynb new file mode 100755 index 00000000..ad09fffb --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch11_1.ipynb @@ -0,0 +1,518 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 11 : Test Signal Generation"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_1,pg 343\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# limits of duty cycle\n",
+ "\n",
+ "import math\n",
+ "#Variable decl;aration\n",
+ "R1=1.0*10**3 #input resistance\n",
+ "R2=1.0*10**3 #feedback resistor\n",
+ "R3=1.0*10**3 #non inverting ter. resistor\n",
+ "R8=1.0*10**3 #potentiometer\n",
+ "R4=1.0*10**3\n",
+ "\n",
+ "#Calculations\n",
+ "DF1=(R1/((2*R1)+R8)) #duty factor lim.-1\n",
+ "DF2=(R1+R4)/((2*R1)+R8) #duty factor lim.-2\n",
+ "#T=(((2*R4*C*((2*R1)+R8)))/R1)*(Vt/Vi)=((6*R4*C*Vt)/Vi)\n",
+ "\n",
+ "#Result\n",
+ "print(\"range of duty factor is DF1 to DF2 i.e.\")\n",
+ "print(\"%.2f to %.2f \"%(DF1,DF2))\n",
+ "print(\"\\nlimits of t1 and t2:\")\n",
+ "print(\"(T/3) to (2T/3)\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "range of duty factor is DF1 to DF2 i.e.\n",
+ "0.33 to 0.67 \n",
+ "\n",
+ "limits of t1 and t2:\n",
+ "(T/3) to (2T/3)\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_2,pg 344"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# determine sinewave amplitude and segment slopes\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vtx=5.0 #triangular peak(+/-)5\n",
+ "Vsx=(2/math.pi)*Vtx #sinewave peak\n",
+ "#if n=3 then there are 2*3=6 break points these are at o/p voltages\n",
+ "n=3.0 #break point parameter\n",
+ "\n",
+ "#Calculations\n",
+ "Vs1=(2/math.pi)*Vtx*math.sin((1*math.pi)/((2*n)+1))\n",
+ "Vs2=(2/math.pi)*Vtx*math.sin((2*math.pi)/((2*n)+1))\n",
+ "Vs3=(2/math.pi)*Vtx*math.sin((3*math.pi)/((2*n)+1))\n",
+ "#calculating slopes\n",
+ "ms1=(((2*n)+1)/math.pi)*(math.sin((math.pi*(1+1))/((2*n)+1))-math.sin((math.pi*1)/((2*n)+1)))\n",
+ "ms2=(((2*n)+1)/math.pi)*(math.sin((math.pi*(2+1))/((2*n)+1))-math.sin((math.pi*2)/((2*n)+1)))\n",
+ "ms3=(((2*n)+1)/math.pi)*(math.sin((math.pi*(3+1))/((2*n)+1))-math.sin((math.pi*3)/((2*n)+1)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"break points:\")\n",
+ "print(\"output voltages:\")\n",
+ "print(\"Vs1 = %.2f V \"%Vs1)\n",
+ "print(\"Vs2 = %.2f V \"%Vs2)\n",
+ "print(\"Vs3 = %.2f V\\n\"%Vs3)\n",
+ "print(\"segment slopes:\")\n",
+ "print(\"ms1 = %.2f \"%ms1)\n",
+ "print(\"ms2 = %.2f \"%ms2)\n",
+ "print(\"ms3 = %.2f \"%ms3)\n",
+ "#Answers are slightly different than book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "break points:\n",
+ "output voltages:\n",
+ "Vs1 = 1.38 V \n",
+ "Vs2 = 2.49 V \n",
+ "Vs3 = 3.10 V\n",
+ "\n",
+ "segment slopes:\n",
+ "ms1 = 0.78 \n",
+ "ms2 = 0.43 \n",
+ "ms3 = 0.00 \n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_3,pg 505"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find inductance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R1=0.0 #resistance\n",
+ "C=0.1*10**-6 #capacitance\n",
+ "f=1.0*10**3 #frequency\n",
+ "\n",
+ "#Calculations\n",
+ "L=(1.0/(((2*math.pi*f)**2)*C))\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print(\"Inductance of circuit:\")\n",
+ "print(\"L = %.6f H \"%(L))\n",
+ "#Answer do not matche with book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Inductance of circuit:\n",
+ "L = 0.253303 H \n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_4,pg 506"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# resonance frequency of crystal\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "C1=4*10**-12 #Capacitance\n",
+ "L=94*10**-3 #inductance \n",
+ "C=13*10**-9 #capacitance\n",
+ "R=91.3 #resistance\n",
+ "\n",
+ "#Calculations\n",
+ "f1=(1/(2*math.pi))*((L*C)**(-1.0/2)) #resonance frequency-1\n",
+ "f2=(math.sqrt(1+(C/C1))/(2*math.pi*math.sqrt(L*C))) #resonance frequency-2\n",
+ "\n",
+ "#Result\n",
+ "print(\"resonance frequency-1:\")\n",
+ "print(\"f1 = %.2f kHz\\n\"%(f1/1000))\n",
+ "print(\"resonance frequency-2:\")\n",
+ "print(\"f2 = %.2f kHz\"%(f2/1000))\n",
+ "#Answer for f2 is slightly different"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "resonance frequency-1:\n",
+ "f1 = 4.55 kHz\n",
+ "\n",
+ "resonance frequency-2:\n",
+ "f2 = 259.59 kHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_5,pg 506\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find R in CR section\n",
+ "\n",
+ "import math\n",
+ "#Result\n",
+ "f=1.0*10**3 #frequency\n",
+ "C=0.01*10**-6 #capacitance\n",
+ "\n",
+ "#Calculations\n",
+ "#f=(1/(2*%pi))*(1/(6^(1/2)*RC))\n",
+ "R=(1/(2*math.pi*(6**(0.5)*C*f)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"resistance of circuit\\n\")\n",
+ "print(\"R = %.1f k-ohm\"%(R/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "resistance of circuit\n",
+ "\n",
+ "R = 6.5 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_6,pg 506"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find phase difference in wein network\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "epsi=0.01 #detuning parameter\n",
+ "eta1=1.0 #(f/fo)=1\n",
+ "eta2=2.2 #(f/fo)=2.2\n",
+ "\n",
+ "#Calculations\n",
+ "#case-1\n",
+ "phi1=math.atan((3*eta1*((eta1**2)-1)*(3+(2*epsi)))/((((eta1**2)-1)**2)*(3+epsi)-(9*epsi*(eta1**2))))\n",
+ "#case-2\n",
+ "phi2=math.atan((3*eta2*((eta2**2)-1)*(3+(2*epsi)))/((((eta2**2)-1)**2)*(3+epsi)-(9*epsi*(eta2**2))))\n",
+ "\n",
+ "#Result\n",
+ "print(\"phase difference for case-1:\")\n",
+ "print(\"phi1 = %d rad\\n\"%phi1)\n",
+ "print(\"phase difference for case-2:\")\n",
+ "print(\"phi2 = %.2f rad\"%phi2)\n",
+ "#Answer for phi2 is not matching with book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "phase difference for case-1:\n",
+ "phi1 = 0 rad\n",
+ "\n",
+ "phase difference for case-2:\n",
+ "phi2 = 1.05 rad\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_7,pg 507"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# digital frequency synthesizer\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "N=12.0 #12-bit synthesizer\n",
+ "k1=1.0 #sampling rate at sampler's rate\n",
+ "k2=4.0 #sampling rate at 4 times sampler's rate\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "#case-1\n",
+ "adv1=(360/(2**N)) #advancement of o/p register \n",
+ "#2pi rad=360 deg.\n",
+ "#case-2\n",
+ "adv2=(4.0*(360)/(2**N)) #advancement of o/p register \n",
+ "\n",
+ "#Result\n",
+ "print(\"advancement of o/p register for case-1:\")\n",
+ "print(\"adv1 = %.4f\u00b0 \\n\"%adv1)\n",
+ "print(\"advancement of o/p register for case-2:\")\n",
+ "print(\"adv2 = %.4f\u00b0\"%adv2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "advancement of o/p register for case-1:\n",
+ "adv1 = 0.0879\u00b0 \n",
+ "\n",
+ "advancement of o/p register for case-2:\n",
+ "adv2 = 0.3516\u00b0\n"
+ ]
+ }
+ ],
+ "prompt_number": 31
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_8,pg 507"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find controlling voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "f=1.0*10**3 #frequency\n",
+ "R6=10.0*10**3 #feed-back resistor\n",
+ "R5=22.0*10**3 #feed-in resistor\n",
+ "R4=10.0*10**3 #integrator resistor\n",
+ "C=0.1*10**-6 #integrator capacitor\n",
+ "Vsx=2.0 #comparator pulse amplitude\n",
+ "\n",
+ "#Calculations\n",
+ "Vi=((f*R4*R5*C)/(R6*4*Vsx)) #controlling voltage\n",
+ "\n",
+ "#Result\n",
+ "print(\"controlling voltage:\")\n",
+ "print(\"Vi = %.3f V\"%Vi)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "controlling voltage:\n",
+ "Vi = 0.275 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_9,pg 507"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find limits of duty factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R1=10.0*10**3\n",
+ "R8=10.0*10**3\n",
+ "R4=10.0*10**3\n",
+ "\n",
+ "#Calculations\n",
+ "lim1=(R1/((2*R1)+R8)) #limit-1 of duty factor\n",
+ "lim2=((R1+R4)/((2*R1)+R8)) #limit-2 of duty factor\n",
+ "\n",
+ "#Result\n",
+ "print(\"duty factors are given by (t1/T) and (t2/T). the limits are giiven by\\n\")\n",
+ "print(\"lim1 = %.2f\"%lim1)\n",
+ "print(\"lim2 = %.2f\"%lim2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "duty factors are given by (t1/T) and (t2/T). the limits are giiven by\n",
+ "\n",
+ "lim1 = 0.33\n",
+ "lim2 = 0.67\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_10,pg 507"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find output voltage V1 and V2\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vi=1.3 #input voltage\n",
+ "R2=10.0*10**3\n",
+ "R3=10.0*10**3\n",
+ "R8=10.0*10**3 #potentiometer\n",
+ "B=1.0/3 #wiper distance\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "V1=((R3*Vi)/(R3+(B*R8))) #output voltage-1\n",
+ "V2=-((R2*Vi)/(R3+((1-B)*R8)))#output voltage-2\n",
+ "\n",
+ "#Result\n",
+ "print(\"ouput voltage-1:\")\n",
+ "print(\"V1 = %.4f V\"%V1)\n",
+ "print(\"ouput voltage-2:\")\n",
+ "print(\"V2 = %.4f V\"%V2)\n",
+ "#Answers are slightly different than book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "ouput voltage-1:\n",
+ "V1 = 0.9750 V\n",
+ "ouput voltage-2:\n",
+ "V2 = -0.7800 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 36
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch11_2.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch11_2.ipynb new file mode 100755 index 00000000..ad09fffb --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch11_2.ipynb @@ -0,0 +1,518 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 11 : Test Signal Generation"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_1,pg 343\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# limits of duty cycle\n",
+ "\n",
+ "import math\n",
+ "#Variable decl;aration\n",
+ "R1=1.0*10**3 #input resistance\n",
+ "R2=1.0*10**3 #feedback resistor\n",
+ "R3=1.0*10**3 #non inverting ter. resistor\n",
+ "R8=1.0*10**3 #potentiometer\n",
+ "R4=1.0*10**3\n",
+ "\n",
+ "#Calculations\n",
+ "DF1=(R1/((2*R1)+R8)) #duty factor lim.-1\n",
+ "DF2=(R1+R4)/((2*R1)+R8) #duty factor lim.-2\n",
+ "#T=(((2*R4*C*((2*R1)+R8)))/R1)*(Vt/Vi)=((6*R4*C*Vt)/Vi)\n",
+ "\n",
+ "#Result\n",
+ "print(\"range of duty factor is DF1 to DF2 i.e.\")\n",
+ "print(\"%.2f to %.2f \"%(DF1,DF2))\n",
+ "print(\"\\nlimits of t1 and t2:\")\n",
+ "print(\"(T/3) to (2T/3)\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "range of duty factor is DF1 to DF2 i.e.\n",
+ "0.33 to 0.67 \n",
+ "\n",
+ "limits of t1 and t2:\n",
+ "(T/3) to (2T/3)\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_2,pg 344"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# determine sinewave amplitude and segment slopes\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vtx=5.0 #triangular peak(+/-)5\n",
+ "Vsx=(2/math.pi)*Vtx #sinewave peak\n",
+ "#if n=3 then there are 2*3=6 break points these are at o/p voltages\n",
+ "n=3.0 #break point parameter\n",
+ "\n",
+ "#Calculations\n",
+ "Vs1=(2/math.pi)*Vtx*math.sin((1*math.pi)/((2*n)+1))\n",
+ "Vs2=(2/math.pi)*Vtx*math.sin((2*math.pi)/((2*n)+1))\n",
+ "Vs3=(2/math.pi)*Vtx*math.sin((3*math.pi)/((2*n)+1))\n",
+ "#calculating slopes\n",
+ "ms1=(((2*n)+1)/math.pi)*(math.sin((math.pi*(1+1))/((2*n)+1))-math.sin((math.pi*1)/((2*n)+1)))\n",
+ "ms2=(((2*n)+1)/math.pi)*(math.sin((math.pi*(2+1))/((2*n)+1))-math.sin((math.pi*2)/((2*n)+1)))\n",
+ "ms3=(((2*n)+1)/math.pi)*(math.sin((math.pi*(3+1))/((2*n)+1))-math.sin((math.pi*3)/((2*n)+1)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"break points:\")\n",
+ "print(\"output voltages:\")\n",
+ "print(\"Vs1 = %.2f V \"%Vs1)\n",
+ "print(\"Vs2 = %.2f V \"%Vs2)\n",
+ "print(\"Vs3 = %.2f V\\n\"%Vs3)\n",
+ "print(\"segment slopes:\")\n",
+ "print(\"ms1 = %.2f \"%ms1)\n",
+ "print(\"ms2 = %.2f \"%ms2)\n",
+ "print(\"ms3 = %.2f \"%ms3)\n",
+ "#Answers are slightly different than book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "break points:\n",
+ "output voltages:\n",
+ "Vs1 = 1.38 V \n",
+ "Vs2 = 2.49 V \n",
+ "Vs3 = 3.10 V\n",
+ "\n",
+ "segment slopes:\n",
+ "ms1 = 0.78 \n",
+ "ms2 = 0.43 \n",
+ "ms3 = 0.00 \n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_3,pg 505"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find inductance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R1=0.0 #resistance\n",
+ "C=0.1*10**-6 #capacitance\n",
+ "f=1.0*10**3 #frequency\n",
+ "\n",
+ "#Calculations\n",
+ "L=(1.0/(((2*math.pi*f)**2)*C))\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print(\"Inductance of circuit:\")\n",
+ "print(\"L = %.6f H \"%(L))\n",
+ "#Answer do not matche with book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Inductance of circuit:\n",
+ "L = 0.253303 H \n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_4,pg 506"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# resonance frequency of crystal\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "C1=4*10**-12 #Capacitance\n",
+ "L=94*10**-3 #inductance \n",
+ "C=13*10**-9 #capacitance\n",
+ "R=91.3 #resistance\n",
+ "\n",
+ "#Calculations\n",
+ "f1=(1/(2*math.pi))*((L*C)**(-1.0/2)) #resonance frequency-1\n",
+ "f2=(math.sqrt(1+(C/C1))/(2*math.pi*math.sqrt(L*C))) #resonance frequency-2\n",
+ "\n",
+ "#Result\n",
+ "print(\"resonance frequency-1:\")\n",
+ "print(\"f1 = %.2f kHz\\n\"%(f1/1000))\n",
+ "print(\"resonance frequency-2:\")\n",
+ "print(\"f2 = %.2f kHz\"%(f2/1000))\n",
+ "#Answer for f2 is slightly different"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "resonance frequency-1:\n",
+ "f1 = 4.55 kHz\n",
+ "\n",
+ "resonance frequency-2:\n",
+ "f2 = 259.59 kHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_5,pg 506\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find R in CR section\n",
+ "\n",
+ "import math\n",
+ "#Result\n",
+ "f=1.0*10**3 #frequency\n",
+ "C=0.01*10**-6 #capacitance\n",
+ "\n",
+ "#Calculations\n",
+ "#f=(1/(2*%pi))*(1/(6^(1/2)*RC))\n",
+ "R=(1/(2*math.pi*(6**(0.5)*C*f)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"resistance of circuit\\n\")\n",
+ "print(\"R = %.1f k-ohm\"%(R/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "resistance of circuit\n",
+ "\n",
+ "R = 6.5 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_6,pg 506"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find phase difference in wein network\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "epsi=0.01 #detuning parameter\n",
+ "eta1=1.0 #(f/fo)=1\n",
+ "eta2=2.2 #(f/fo)=2.2\n",
+ "\n",
+ "#Calculations\n",
+ "#case-1\n",
+ "phi1=math.atan((3*eta1*((eta1**2)-1)*(3+(2*epsi)))/((((eta1**2)-1)**2)*(3+epsi)-(9*epsi*(eta1**2))))\n",
+ "#case-2\n",
+ "phi2=math.atan((3*eta2*((eta2**2)-1)*(3+(2*epsi)))/((((eta2**2)-1)**2)*(3+epsi)-(9*epsi*(eta2**2))))\n",
+ "\n",
+ "#Result\n",
+ "print(\"phase difference for case-1:\")\n",
+ "print(\"phi1 = %d rad\\n\"%phi1)\n",
+ "print(\"phase difference for case-2:\")\n",
+ "print(\"phi2 = %.2f rad\"%phi2)\n",
+ "#Answer for phi2 is not matching with book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "phase difference for case-1:\n",
+ "phi1 = 0 rad\n",
+ "\n",
+ "phase difference for case-2:\n",
+ "phi2 = 1.05 rad\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_7,pg 507"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# digital frequency synthesizer\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "N=12.0 #12-bit synthesizer\n",
+ "k1=1.0 #sampling rate at sampler's rate\n",
+ "k2=4.0 #sampling rate at 4 times sampler's rate\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "#case-1\n",
+ "adv1=(360/(2**N)) #advancement of o/p register \n",
+ "#2pi rad=360 deg.\n",
+ "#case-2\n",
+ "adv2=(4.0*(360)/(2**N)) #advancement of o/p register \n",
+ "\n",
+ "#Result\n",
+ "print(\"advancement of o/p register for case-1:\")\n",
+ "print(\"adv1 = %.4f\u00b0 \\n\"%adv1)\n",
+ "print(\"advancement of o/p register for case-2:\")\n",
+ "print(\"adv2 = %.4f\u00b0\"%adv2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "advancement of o/p register for case-1:\n",
+ "adv1 = 0.0879\u00b0 \n",
+ "\n",
+ "advancement of o/p register for case-2:\n",
+ "adv2 = 0.3516\u00b0\n"
+ ]
+ }
+ ],
+ "prompt_number": 31
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_8,pg 507"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find controlling voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "f=1.0*10**3 #frequency\n",
+ "R6=10.0*10**3 #feed-back resistor\n",
+ "R5=22.0*10**3 #feed-in resistor\n",
+ "R4=10.0*10**3 #integrator resistor\n",
+ "C=0.1*10**-6 #integrator capacitor\n",
+ "Vsx=2.0 #comparator pulse amplitude\n",
+ "\n",
+ "#Calculations\n",
+ "Vi=((f*R4*R5*C)/(R6*4*Vsx)) #controlling voltage\n",
+ "\n",
+ "#Result\n",
+ "print(\"controlling voltage:\")\n",
+ "print(\"Vi = %.3f V\"%Vi)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "controlling voltage:\n",
+ "Vi = 0.275 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_9,pg 507"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find limits of duty factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R1=10.0*10**3\n",
+ "R8=10.0*10**3\n",
+ "R4=10.0*10**3\n",
+ "\n",
+ "#Calculations\n",
+ "lim1=(R1/((2*R1)+R8)) #limit-1 of duty factor\n",
+ "lim2=((R1+R4)/((2*R1)+R8)) #limit-2 of duty factor\n",
+ "\n",
+ "#Result\n",
+ "print(\"duty factors are given by (t1/T) and (t2/T). the limits are giiven by\\n\")\n",
+ "print(\"lim1 = %.2f\"%lim1)\n",
+ "print(\"lim2 = %.2f\"%lim2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "duty factors are given by (t1/T) and (t2/T). the limits are giiven by\n",
+ "\n",
+ "lim1 = 0.33\n",
+ "lim2 = 0.67\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example11_10,pg 507"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find output voltage V1 and V2\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vi=1.3 #input voltage\n",
+ "R2=10.0*10**3\n",
+ "R3=10.0*10**3\n",
+ "R8=10.0*10**3 #potentiometer\n",
+ "B=1.0/3 #wiper distance\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "V1=((R3*Vi)/(R3+(B*R8))) #output voltage-1\n",
+ "V2=-((R2*Vi)/(R3+((1-B)*R8)))#output voltage-2\n",
+ "\n",
+ "#Result\n",
+ "print(\"ouput voltage-1:\")\n",
+ "print(\"V1 = %.4f V\"%V1)\n",
+ "print(\"ouput voltage-2:\")\n",
+ "print(\"V2 = %.4f V\"%V2)\n",
+ "#Answers are slightly different than book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "ouput voltage-1:\n",
+ "V1 = 0.9750 V\n",
+ "ouput voltage-2:\n",
+ "V2 = -0.7800 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 36
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch12.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch12.ipynb new file mode 100755 index 00000000..49c7124a --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch12.ipynb @@ -0,0 +1,432 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 12 : Display Record And Acquisition Of Data"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_1,pg 371"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find excitation voltage and electrode areas\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "E=10**6 #electric field\n",
+ "l=10**-6 #thickness of LCD\n",
+ "V=E*l #excitation potential\n",
+ "I=0.1*10**-6 #current\n",
+ "rho=E/I #crystal resistivity\n",
+ "P=10*10**-6 #power consumption\n",
+ "A=(P/(V*I)) #area of electrodes\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print(\"excitation potential:\")\n",
+ "print(\"V = %.f V\\n\"%V)\n",
+ "print(\"crystal resistivity:\")\n",
+ "print(\"rho = %.f * 10^-12 ohm-cm\\n\"%(rho*10**-12))\n",
+ "print(\"area of electrodes:\")\n",
+ "print(\"A = %.f cm^2\"%(A))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "excitation potential:\n",
+ "V = 1 V\n",
+ "\n",
+ "crystal resistivity:\n",
+ "rho = 10 * 10^-12 ohm-cm\n",
+ "\n",
+ "area of electrodes:\n",
+ "A = 100 cm^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_2,pg 383"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find deviation factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fc=10**6 #carrier frequency\n",
+ "m=0.4 #modulation index\n",
+ "fs=100.0 #signal frequency\n",
+ "V=2.0 #(+/-)2V range\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "delfc1=m*fc #frequency deviation for FS(full scale)\n",
+ "#(+/-) 2V corresponds to delfc Hz deviation assuming linear shift, for (+/-)1V\n",
+ "delfc2=delfc1/V #frequency deviation for (+/-)1V range\n",
+ "sig=(delfc1/fs) #deviation factor\n",
+ "\n",
+ "#Result\n",
+ "print(\"frequency deviation for FS:\")\n",
+ "print(\"delfc1 = %.f * 10^5 Hz\\n\"%(delfc1/10**5)) \n",
+ "print(\"frequency deviation for given range:\")\n",
+ "print(\"delfc2 = %.f * 10^5 Hz\\n\"%(delfc2/10**5)) \n",
+ "print(\"deviation factor:\")\n",
+ "print(\"sig = %.f * 10^3\"%(sig/10**3))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "frequency deviation for FS:\n",
+ "delfc1 = 4 * 10^5 Hz\n",
+ "\n",
+ "frequency deviation for given range:\n",
+ "delfc2 = 2 * 10^5 Hz\n",
+ "\n",
+ "deviation factor:\n",
+ "sig = 4 * 10^3\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_3,pg 508"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find wavelength of radiation\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "h=6.625*10**-34 #planck's const.\n",
+ "e=1.6*10**-19 #electron charge\n",
+ "c=2.998*10**8 #speed of light\n",
+ "E=2.02 #energy gap\n",
+ "\n",
+ "#Calculations\n",
+ "lam=((h*c)/E) #wavelength of radiation(m/eV)\n",
+ "#1eV=16.017*10^-20J\n",
+ "lam=(lam/(16.017*10**-20)) #conversion in meter\n",
+ "\n",
+ "#Result\n",
+ "print(\"wavelength of radiation:\")\n",
+ "print(\"lam = %.4f * 10^-6 m\"%(math.floor(lam*10**10)/10**4))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "wavelength of radiation:\n",
+ "lam = 0.6138 * 10^-6 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_4,pg 508\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# thickness of LCD crystal\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "V=1.3 #excitation voltage\n",
+ "Vgrad=10.0**5 #potential gradient\n",
+ "\n",
+ "#Calculations\n",
+ "#10^5 V/mm*thickness in mm=excitation voltage\n",
+ "l=(V/Vgrad) #thickness of LCD\n",
+ "\n",
+ "#Result\n",
+ "print(\"thickness of LCD:\")\n",
+ "print(\"l = %.f micro-m\"%(l*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "thickness of LCD:\n",
+ "l = 13 micro-m\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_5,pg 508"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find current density\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "rho=4.0*10**12 #resistivity of LCD\n",
+ "Vgrad=10.0**6 #potential gradient\n",
+ "\n",
+ "#Calculations\n",
+ "j=(Vgrad/rho) #current density\n",
+ "\n",
+ "#Result\n",
+ "print(\"current per cm^2:\")\n",
+ "print(\"j = %.2f micro-A/cm^2\"%(j*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "current per cm^2:\n",
+ "j = 0.25 micro-A/cm^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_6,pg 508"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find magnetic flux in tape\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "f=2*10**3 #frequency of signal\n",
+ "v=1.0 #velocity of tape\n",
+ "w=0.05*10**-3 #gap width\n",
+ "N=22.0 #no.of turns on head\n",
+ "V=31*10**-3 #rms voltage o/p\n",
+ "\n",
+ "#Calculations\n",
+ "x=(math.pi*f*w)/v\n",
+ "x=x*(math.pi/180)\n",
+ "M=((V*w)/(2*v*N*math.sin(x)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"magnetic flux in tape:\")\n",
+ "print(\"M = %.2f micro-Wb\"%(M*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "magnetic flux in tape:\n",
+ "M = 6.42 micro-Wb\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_7,pg 509"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# channel accomodation\n",
+ "\n",
+ "import math\n",
+ "#variable declartion\n",
+ "Br=576.0*10**3 #bit rate conversion\n",
+ "n=8.0 #resolution requirement per channel\n",
+ "fs=1000.0 #sampling rate\n",
+ "\n",
+ "#Calculations\n",
+ "N=(Br/(fs*3*n)) #no. of channels\n",
+ "\n",
+ "#Result\n",
+ "print(\"no. of channels accomodated:\")\n",
+ "print(\"N = %.f \"%N)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "no. of channels accomodated:\n",
+ "N = 24 \n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_8,pg 509\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# sensor signal transmission\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Rsmax=1.0*10**3 #sensor resistance max.\n",
+ "Rsmin=100.0 #sensor resistance min.\n",
+ "Vs=5.0 #sensor voltage\n",
+ "\n",
+ "#Calculations\n",
+ "Io=(Vs/Rsmax) #current source-> ohm's law\n",
+ "Vmin=Rsmin*Io #min. output voltage\n",
+ "\n",
+ "#Result\n",
+ "print(\"current source:\")\n",
+ "print(\"Io = %.f mA\\n\"%(Io*10**3))\n",
+ "print(\"min. output voltage:\")\n",
+ "print(\"Vmin = %.1f V\"%Vmin)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "current source:\n",
+ "Io = 5 mA\n",
+ "\n",
+ "min. output voltage:\n",
+ "Vmin = 0.5 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_9,pg 509\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# ROM access time\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#ROM 22*5*7\n",
+ "N=5.0 #no. of gates in bitand plane\n",
+ "n=22.0 #no.of inputs\n",
+ "f=913.0 #refresh rate\n",
+ "\n",
+ "#Calculations\n",
+ "#considering column display\n",
+ "ts=(1.0/(N*f*n)) #ROM access time\n",
+ "\n",
+ "#Result\n",
+ "print(\"ROM access time:\")\n",
+ "print(\"ts = %.6f ms\"%(ts*1000))\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "ROM access time:\n",
+ "ts = 0.009957 ms\n"
+ ]
+ }
+ ],
+ "prompt_number": 31
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch12_1.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch12_1.ipynb new file mode 100755 index 00000000..49c7124a --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch12_1.ipynb @@ -0,0 +1,432 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 12 : Display Record And Acquisition Of Data"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_1,pg 371"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find excitation voltage and electrode areas\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "E=10**6 #electric field\n",
+ "l=10**-6 #thickness of LCD\n",
+ "V=E*l #excitation potential\n",
+ "I=0.1*10**-6 #current\n",
+ "rho=E/I #crystal resistivity\n",
+ "P=10*10**-6 #power consumption\n",
+ "A=(P/(V*I)) #area of electrodes\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print(\"excitation potential:\")\n",
+ "print(\"V = %.f V\\n\"%V)\n",
+ "print(\"crystal resistivity:\")\n",
+ "print(\"rho = %.f * 10^-12 ohm-cm\\n\"%(rho*10**-12))\n",
+ "print(\"area of electrodes:\")\n",
+ "print(\"A = %.f cm^2\"%(A))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "excitation potential:\n",
+ "V = 1 V\n",
+ "\n",
+ "crystal resistivity:\n",
+ "rho = 10 * 10^-12 ohm-cm\n",
+ "\n",
+ "area of electrodes:\n",
+ "A = 100 cm^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_2,pg 383"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find deviation factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fc=10**6 #carrier frequency\n",
+ "m=0.4 #modulation index\n",
+ "fs=100.0 #signal frequency\n",
+ "V=2.0 #(+/-)2V range\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "delfc1=m*fc #frequency deviation for FS(full scale)\n",
+ "#(+/-) 2V corresponds to delfc Hz deviation assuming linear shift, for (+/-)1V\n",
+ "delfc2=delfc1/V #frequency deviation for (+/-)1V range\n",
+ "sig=(delfc1/fs) #deviation factor\n",
+ "\n",
+ "#Result\n",
+ "print(\"frequency deviation for FS:\")\n",
+ "print(\"delfc1 = %.f * 10^5 Hz\\n\"%(delfc1/10**5)) \n",
+ "print(\"frequency deviation for given range:\")\n",
+ "print(\"delfc2 = %.f * 10^5 Hz\\n\"%(delfc2/10**5)) \n",
+ "print(\"deviation factor:\")\n",
+ "print(\"sig = %.f * 10^3\"%(sig/10**3))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "frequency deviation for FS:\n",
+ "delfc1 = 4 * 10^5 Hz\n",
+ "\n",
+ "frequency deviation for given range:\n",
+ "delfc2 = 2 * 10^5 Hz\n",
+ "\n",
+ "deviation factor:\n",
+ "sig = 4 * 10^3\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_3,pg 508"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find wavelength of radiation\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "h=6.625*10**-34 #planck's const.\n",
+ "e=1.6*10**-19 #electron charge\n",
+ "c=2.998*10**8 #speed of light\n",
+ "E=2.02 #energy gap\n",
+ "\n",
+ "#Calculations\n",
+ "lam=((h*c)/E) #wavelength of radiation(m/eV)\n",
+ "#1eV=16.017*10^-20J\n",
+ "lam=(lam/(16.017*10**-20)) #conversion in meter\n",
+ "\n",
+ "#Result\n",
+ "print(\"wavelength of radiation:\")\n",
+ "print(\"lam = %.4f * 10^-6 m\"%(math.floor(lam*10**10)/10**4))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "wavelength of radiation:\n",
+ "lam = 0.6138 * 10^-6 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_4,pg 508\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# thickness of LCD crystal\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "V=1.3 #excitation voltage\n",
+ "Vgrad=10.0**5 #potential gradient\n",
+ "\n",
+ "#Calculations\n",
+ "#10^5 V/mm*thickness in mm=excitation voltage\n",
+ "l=(V/Vgrad) #thickness of LCD\n",
+ "\n",
+ "#Result\n",
+ "print(\"thickness of LCD:\")\n",
+ "print(\"l = %.f micro-m\"%(l*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "thickness of LCD:\n",
+ "l = 13 micro-m\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_5,pg 508"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find current density\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "rho=4.0*10**12 #resistivity of LCD\n",
+ "Vgrad=10.0**6 #potential gradient\n",
+ "\n",
+ "#Calculations\n",
+ "j=(Vgrad/rho) #current density\n",
+ "\n",
+ "#Result\n",
+ "print(\"current per cm^2:\")\n",
+ "print(\"j = %.2f micro-A/cm^2\"%(j*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "current per cm^2:\n",
+ "j = 0.25 micro-A/cm^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_6,pg 508"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find magnetic flux in tape\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "f=2*10**3 #frequency of signal\n",
+ "v=1.0 #velocity of tape\n",
+ "w=0.05*10**-3 #gap width\n",
+ "N=22.0 #no.of turns on head\n",
+ "V=31*10**-3 #rms voltage o/p\n",
+ "\n",
+ "#Calculations\n",
+ "x=(math.pi*f*w)/v\n",
+ "x=x*(math.pi/180)\n",
+ "M=((V*w)/(2*v*N*math.sin(x)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"magnetic flux in tape:\")\n",
+ "print(\"M = %.2f micro-Wb\"%(M*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "magnetic flux in tape:\n",
+ "M = 6.42 micro-Wb\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_7,pg 509"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# channel accomodation\n",
+ "\n",
+ "import math\n",
+ "#variable declartion\n",
+ "Br=576.0*10**3 #bit rate conversion\n",
+ "n=8.0 #resolution requirement per channel\n",
+ "fs=1000.0 #sampling rate\n",
+ "\n",
+ "#Calculations\n",
+ "N=(Br/(fs*3*n)) #no. of channels\n",
+ "\n",
+ "#Result\n",
+ "print(\"no. of channels accomodated:\")\n",
+ "print(\"N = %.f \"%N)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "no. of channels accomodated:\n",
+ "N = 24 \n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_8,pg 509\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# sensor signal transmission\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Rsmax=1.0*10**3 #sensor resistance max.\n",
+ "Rsmin=100.0 #sensor resistance min.\n",
+ "Vs=5.0 #sensor voltage\n",
+ "\n",
+ "#Calculations\n",
+ "Io=(Vs/Rsmax) #current source-> ohm's law\n",
+ "Vmin=Rsmin*Io #min. output voltage\n",
+ "\n",
+ "#Result\n",
+ "print(\"current source:\")\n",
+ "print(\"Io = %.f mA\\n\"%(Io*10**3))\n",
+ "print(\"min. output voltage:\")\n",
+ "print(\"Vmin = %.1f V\"%Vmin)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "current source:\n",
+ "Io = 5 mA\n",
+ "\n",
+ "min. output voltage:\n",
+ "Vmin = 0.5 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_9,pg 509\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# ROM access time\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#ROM 22*5*7\n",
+ "N=5.0 #no. of gates in bitand plane\n",
+ "n=22.0 #no.of inputs\n",
+ "f=913.0 #refresh rate\n",
+ "\n",
+ "#Calculations\n",
+ "#considering column display\n",
+ "ts=(1.0/(N*f*n)) #ROM access time\n",
+ "\n",
+ "#Result\n",
+ "print(\"ROM access time:\")\n",
+ "print(\"ts = %.6f ms\"%(ts*1000))\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "ROM access time:\n",
+ "ts = 0.009957 ms\n"
+ ]
+ }
+ ],
+ "prompt_number": 31
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch12_2.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch12_2.ipynb new file mode 100755 index 00000000..49c7124a --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch12_2.ipynb @@ -0,0 +1,432 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 12 : Display Record And Acquisition Of Data"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_1,pg 371"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find excitation voltage and electrode areas\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "E=10**6 #electric field\n",
+ "l=10**-6 #thickness of LCD\n",
+ "V=E*l #excitation potential\n",
+ "I=0.1*10**-6 #current\n",
+ "rho=E/I #crystal resistivity\n",
+ "P=10*10**-6 #power consumption\n",
+ "A=(P/(V*I)) #area of electrodes\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print(\"excitation potential:\")\n",
+ "print(\"V = %.f V\\n\"%V)\n",
+ "print(\"crystal resistivity:\")\n",
+ "print(\"rho = %.f * 10^-12 ohm-cm\\n\"%(rho*10**-12))\n",
+ "print(\"area of electrodes:\")\n",
+ "print(\"A = %.f cm^2\"%(A))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "excitation potential:\n",
+ "V = 1 V\n",
+ "\n",
+ "crystal resistivity:\n",
+ "rho = 10 * 10^-12 ohm-cm\n",
+ "\n",
+ "area of electrodes:\n",
+ "A = 100 cm^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_2,pg 383"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find deviation factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fc=10**6 #carrier frequency\n",
+ "m=0.4 #modulation index\n",
+ "fs=100.0 #signal frequency\n",
+ "V=2.0 #(+/-)2V range\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "delfc1=m*fc #frequency deviation for FS(full scale)\n",
+ "#(+/-) 2V corresponds to delfc Hz deviation assuming linear shift, for (+/-)1V\n",
+ "delfc2=delfc1/V #frequency deviation for (+/-)1V range\n",
+ "sig=(delfc1/fs) #deviation factor\n",
+ "\n",
+ "#Result\n",
+ "print(\"frequency deviation for FS:\")\n",
+ "print(\"delfc1 = %.f * 10^5 Hz\\n\"%(delfc1/10**5)) \n",
+ "print(\"frequency deviation for given range:\")\n",
+ "print(\"delfc2 = %.f * 10^5 Hz\\n\"%(delfc2/10**5)) \n",
+ "print(\"deviation factor:\")\n",
+ "print(\"sig = %.f * 10^3\"%(sig/10**3))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "frequency deviation for FS:\n",
+ "delfc1 = 4 * 10^5 Hz\n",
+ "\n",
+ "frequency deviation for given range:\n",
+ "delfc2 = 2 * 10^5 Hz\n",
+ "\n",
+ "deviation factor:\n",
+ "sig = 4 * 10^3\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_3,pg 508"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find wavelength of radiation\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "h=6.625*10**-34 #planck's const.\n",
+ "e=1.6*10**-19 #electron charge\n",
+ "c=2.998*10**8 #speed of light\n",
+ "E=2.02 #energy gap\n",
+ "\n",
+ "#Calculations\n",
+ "lam=((h*c)/E) #wavelength of radiation(m/eV)\n",
+ "#1eV=16.017*10^-20J\n",
+ "lam=(lam/(16.017*10**-20)) #conversion in meter\n",
+ "\n",
+ "#Result\n",
+ "print(\"wavelength of radiation:\")\n",
+ "print(\"lam = %.4f * 10^-6 m\"%(math.floor(lam*10**10)/10**4))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "wavelength of radiation:\n",
+ "lam = 0.6138 * 10^-6 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_4,pg 508\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# thickness of LCD crystal\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "V=1.3 #excitation voltage\n",
+ "Vgrad=10.0**5 #potential gradient\n",
+ "\n",
+ "#Calculations\n",
+ "#10^5 V/mm*thickness in mm=excitation voltage\n",
+ "l=(V/Vgrad) #thickness of LCD\n",
+ "\n",
+ "#Result\n",
+ "print(\"thickness of LCD:\")\n",
+ "print(\"l = %.f micro-m\"%(l*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "thickness of LCD:\n",
+ "l = 13 micro-m\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_5,pg 508"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find current density\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "rho=4.0*10**12 #resistivity of LCD\n",
+ "Vgrad=10.0**6 #potential gradient\n",
+ "\n",
+ "#Calculations\n",
+ "j=(Vgrad/rho) #current density\n",
+ "\n",
+ "#Result\n",
+ "print(\"current per cm^2:\")\n",
+ "print(\"j = %.2f micro-A/cm^2\"%(j*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "current per cm^2:\n",
+ "j = 0.25 micro-A/cm^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_6,pg 508"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find magnetic flux in tape\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "f=2*10**3 #frequency of signal\n",
+ "v=1.0 #velocity of tape\n",
+ "w=0.05*10**-3 #gap width\n",
+ "N=22.0 #no.of turns on head\n",
+ "V=31*10**-3 #rms voltage o/p\n",
+ "\n",
+ "#Calculations\n",
+ "x=(math.pi*f*w)/v\n",
+ "x=x*(math.pi/180)\n",
+ "M=((V*w)/(2*v*N*math.sin(x)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"magnetic flux in tape:\")\n",
+ "print(\"M = %.2f micro-Wb\"%(M*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "magnetic flux in tape:\n",
+ "M = 6.42 micro-Wb\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_7,pg 509"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# channel accomodation\n",
+ "\n",
+ "import math\n",
+ "#variable declartion\n",
+ "Br=576.0*10**3 #bit rate conversion\n",
+ "n=8.0 #resolution requirement per channel\n",
+ "fs=1000.0 #sampling rate\n",
+ "\n",
+ "#Calculations\n",
+ "N=(Br/(fs*3*n)) #no. of channels\n",
+ "\n",
+ "#Result\n",
+ "print(\"no. of channels accomodated:\")\n",
+ "print(\"N = %.f \"%N)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "no. of channels accomodated:\n",
+ "N = 24 \n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_8,pg 509\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# sensor signal transmission\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Rsmax=1.0*10**3 #sensor resistance max.\n",
+ "Rsmin=100.0 #sensor resistance min.\n",
+ "Vs=5.0 #sensor voltage\n",
+ "\n",
+ "#Calculations\n",
+ "Io=(Vs/Rsmax) #current source-> ohm's law\n",
+ "Vmin=Rsmin*Io #min. output voltage\n",
+ "\n",
+ "#Result\n",
+ "print(\"current source:\")\n",
+ "print(\"Io = %.f mA\\n\"%(Io*10**3))\n",
+ "print(\"min. output voltage:\")\n",
+ "print(\"Vmin = %.1f V\"%Vmin)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "current source:\n",
+ "Io = 5 mA\n",
+ "\n",
+ "min. output voltage:\n",
+ "Vmin = 0.5 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example12_9,pg 509\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# ROM access time\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#ROM 22*5*7\n",
+ "N=5.0 #no. of gates in bitand plane\n",
+ "n=22.0 #no.of inputs\n",
+ "f=913.0 #refresh rate\n",
+ "\n",
+ "#Calculations\n",
+ "#considering column display\n",
+ "ts=(1.0/(N*f*n)) #ROM access time\n",
+ "\n",
+ "#Result\n",
+ "print(\"ROM access time:\")\n",
+ "print(\"ts = %.6f ms\"%(ts*1000))\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "ROM access time:\n",
+ "ts = 0.009957 ms\n"
+ ]
+ }
+ ],
+ "prompt_number": 31
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch13.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch13.ipynb new file mode 100755 index 00000000..a9e47981 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch13.ipynb @@ -0,0 +1,168 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 13: Shielding And Grounding"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example13_1,pg 405"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find diagnostic ratio\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "t1=0.1*10**-6 #time span for voltage\n",
+ "t2=1*10**-6 #time span for current\n",
+ "\n",
+ "#voltage switching\n",
+ "V1=0.5 #level-1\n",
+ "V2=5.0 #level-2\n",
+ "\n",
+ "#current switching\n",
+ "I1=0 #level-1\n",
+ "I2=10*10**-3 #level-2\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "DR=(((V2-V1)/t1)/((I2-I1)/t2))\n",
+ "\n",
+ "#Result\n",
+ "print(\"dissipation ratio:\")\n",
+ "print(\"DR = %.f ohm\\n\"%DR)\n",
+ "print(\"DR is quite large indicating noise interference by capacitive coupling.\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "dissipation ratio:\n",
+ "DR = 4500 ohm\n",
+ "\n",
+ "DR is quite large indicating noise interference by capacitive coupling.\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example13_2,pg 509"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find diagnostic ratio\n",
+ "\n",
+ "import math\n",
+ "#variable declaration\n",
+ "t1=1*10**-6 #time span for voltage\n",
+ "t2=1*10**-6 #time span for current\n",
+ "\n",
+ "#voltage switching\n",
+ "V1=0.5 #level-1\n",
+ "V2=1.0 #level-2\n",
+ "\n",
+ "#current switching\n",
+ "I1=1*10**-3 #level-1\n",
+ "I2=10*10**-3 #level-2\n",
+ "\n",
+ "#Calculations\n",
+ "DR=(((V2-V1)/t1)/((I2-I1)/t2))\n",
+ "\n",
+ "#Result\n",
+ "print(\"pseudoimpedance:\")\n",
+ "print(\"DR = %.f ohm\\n\"%(math.floor(DR)))\n",
+ "print(\"DR is not quite large indicating noise interference by inductive coupling.\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "pseudoimpedance:\n",
+ "DR = 55 ohm\n",
+ "\n",
+ "DR is not quite large indicating noise interference by inductive coupling.\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example13_3,pg 510"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find ground loop current\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vi=12.0 #input DC voltage\n",
+ "Vo=3.182 #output voltage\n",
+ "Rg=130*10**3 #grounding resistance \n",
+ "R2=1*10**3 #output resistance\n",
+ "R1=6.8*10**3 #divider chain\n",
+ "\n",
+ "#Calculations\n",
+ "Ig=(Vo-((2*R2*Vi)/(R1+R2)))/Rg\n",
+ "\n",
+ "#Result\n",
+ "print(\"grounding loop current:\")\n",
+ "print(\"Ig = %.1f micro-A\"%(Ig*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "grounding loop current:\n",
+ "Ig = 0.8 micro-A\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch13_1.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch13_1.ipynb new file mode 100755 index 00000000..a9e47981 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch13_1.ipynb @@ -0,0 +1,168 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 13: Shielding And Grounding"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example13_1,pg 405"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find diagnostic ratio\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "t1=0.1*10**-6 #time span for voltage\n",
+ "t2=1*10**-6 #time span for current\n",
+ "\n",
+ "#voltage switching\n",
+ "V1=0.5 #level-1\n",
+ "V2=5.0 #level-2\n",
+ "\n",
+ "#current switching\n",
+ "I1=0 #level-1\n",
+ "I2=10*10**-3 #level-2\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "DR=(((V2-V1)/t1)/((I2-I1)/t2))\n",
+ "\n",
+ "#Result\n",
+ "print(\"dissipation ratio:\")\n",
+ "print(\"DR = %.f ohm\\n\"%DR)\n",
+ "print(\"DR is quite large indicating noise interference by capacitive coupling.\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "dissipation ratio:\n",
+ "DR = 4500 ohm\n",
+ "\n",
+ "DR is quite large indicating noise interference by capacitive coupling.\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example13_2,pg 509"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find diagnostic ratio\n",
+ "\n",
+ "import math\n",
+ "#variable declaration\n",
+ "t1=1*10**-6 #time span for voltage\n",
+ "t2=1*10**-6 #time span for current\n",
+ "\n",
+ "#voltage switching\n",
+ "V1=0.5 #level-1\n",
+ "V2=1.0 #level-2\n",
+ "\n",
+ "#current switching\n",
+ "I1=1*10**-3 #level-1\n",
+ "I2=10*10**-3 #level-2\n",
+ "\n",
+ "#Calculations\n",
+ "DR=(((V2-V1)/t1)/((I2-I1)/t2))\n",
+ "\n",
+ "#Result\n",
+ "print(\"pseudoimpedance:\")\n",
+ "print(\"DR = %.f ohm\\n\"%(math.floor(DR)))\n",
+ "print(\"DR is not quite large indicating noise interference by inductive coupling.\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "pseudoimpedance:\n",
+ "DR = 55 ohm\n",
+ "\n",
+ "DR is not quite large indicating noise interference by inductive coupling.\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example13_3,pg 510"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find ground loop current\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vi=12.0 #input DC voltage\n",
+ "Vo=3.182 #output voltage\n",
+ "Rg=130*10**3 #grounding resistance \n",
+ "R2=1*10**3 #output resistance\n",
+ "R1=6.8*10**3 #divider chain\n",
+ "\n",
+ "#Calculations\n",
+ "Ig=(Vo-((2*R2*Vi)/(R1+R2)))/Rg\n",
+ "\n",
+ "#Result\n",
+ "print(\"grounding loop current:\")\n",
+ "print(\"Ig = %.1f micro-A\"%(Ig*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "grounding loop current:\n",
+ "Ig = 0.8 micro-A\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch13_2.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch13_2.ipynb new file mode 100755 index 00000000..a9e47981 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch13_2.ipynb @@ -0,0 +1,168 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 13: Shielding And Grounding"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example13_1,pg 405"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find diagnostic ratio\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "t1=0.1*10**-6 #time span for voltage\n",
+ "t2=1*10**-6 #time span for current\n",
+ "\n",
+ "#voltage switching\n",
+ "V1=0.5 #level-1\n",
+ "V2=5.0 #level-2\n",
+ "\n",
+ "#current switching\n",
+ "I1=0 #level-1\n",
+ "I2=10*10**-3 #level-2\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "DR=(((V2-V1)/t1)/((I2-I1)/t2))\n",
+ "\n",
+ "#Result\n",
+ "print(\"dissipation ratio:\")\n",
+ "print(\"DR = %.f ohm\\n\"%DR)\n",
+ "print(\"DR is quite large indicating noise interference by capacitive coupling.\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "dissipation ratio:\n",
+ "DR = 4500 ohm\n",
+ "\n",
+ "DR is quite large indicating noise interference by capacitive coupling.\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example13_2,pg 509"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find diagnostic ratio\n",
+ "\n",
+ "import math\n",
+ "#variable declaration\n",
+ "t1=1*10**-6 #time span for voltage\n",
+ "t2=1*10**-6 #time span for current\n",
+ "\n",
+ "#voltage switching\n",
+ "V1=0.5 #level-1\n",
+ "V2=1.0 #level-2\n",
+ "\n",
+ "#current switching\n",
+ "I1=1*10**-3 #level-1\n",
+ "I2=10*10**-3 #level-2\n",
+ "\n",
+ "#Calculations\n",
+ "DR=(((V2-V1)/t1)/((I2-I1)/t2))\n",
+ "\n",
+ "#Result\n",
+ "print(\"pseudoimpedance:\")\n",
+ "print(\"DR = %.f ohm\\n\"%(math.floor(DR)))\n",
+ "print(\"DR is not quite large indicating noise interference by inductive coupling.\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "pseudoimpedance:\n",
+ "DR = 55 ohm\n",
+ "\n",
+ "DR is not quite large indicating noise interference by inductive coupling.\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example13_3,pg 510"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find ground loop current\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vi=12.0 #input DC voltage\n",
+ "Vo=3.182 #output voltage\n",
+ "Rg=130*10**3 #grounding resistance \n",
+ "R2=1*10**3 #output resistance\n",
+ "R1=6.8*10**3 #divider chain\n",
+ "\n",
+ "#Calculations\n",
+ "Ig=(Vo-((2*R2*Vi)/(R1+R2)))/Rg\n",
+ "\n",
+ "#Result\n",
+ "print(\"grounding loop current:\")\n",
+ "print(\"Ig = %.1f micro-A\"%(Ig*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "grounding loop current:\n",
+ "Ig = 0.8 micro-A\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch14.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch14.ipynb new file mode 100755 index 00000000..da8a1301 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch14.ipynb @@ -0,0 +1,526 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 14 : Transducers And The Measurement System"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_1,pg 421"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find percentage change in resistance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "delVo=120*10**-3 #output voltage\n",
+ "Vs=12.0 #supply voltage\n",
+ "R=120.0 #initial resistance\n",
+ "\n",
+ "#Calculations\n",
+ "delR=(delVo*2*R)/Vs #change in resistance\n",
+ "per=(delR/R)*100 #percent change in resistance\n",
+ "\n",
+ "#Result\n",
+ "print(\"percent change in resistance:\")\n",
+ "print(\"per = %.f\"%per)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "percent change in resistance:\n",
+ "per = 2\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_2,pg 423"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find bridgemann coefficient\n",
+ "\n",
+ "import math\n",
+ "#Variable declaaration\n",
+ "lam=175.0 #gauge factor\n",
+ "mu=0.18 #poisson's ratio\n",
+ "E=18.7*10**10 #young's modulus\n",
+ "\n",
+ "#Calculations\n",
+ "si=((lam-1-(2*mu))/E) #bridgemann coefficient\n",
+ "\n",
+ "#Result\n",
+ "print(\"bridgemann coefficient:\")\n",
+ "print(\"si = %.2f * 10^-10 m^2/N\"%(math.floor(si*10**12)/100))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "bridgemann coefficient:\n",
+ "si = 9.28 * 10^-10 m^2/N\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_3,pg 428"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# pt100 RTD\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R4=10*10**3\n",
+ "Ro=-2.2*10**3 #output resistance\n",
+ "R2=R4-0.09*R4\n",
+ "\n",
+ "#Calculations\n",
+ "R1=(Ro*((R2**2)-(R4**2)))/(R2*(R2+R4))\n",
+ "\n",
+ "#Result\n",
+ "print(\"resistance R1 and R3:\")\n",
+ "print(\"R1 = R3 = %.1f ohm\"%(math.floor(R1*10)/10))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "resistance R1 and R3:\n",
+ "R1 = R3 = 217.5 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_4,pg 435"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# senstivity in measurement of capacitance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#assuming eps1=9.85*10^12\n",
+ "x=4.0 #separation between plates\n",
+ "x3=1.0 #thickness of dielectric\n",
+ "eps1=9.85*10**12 #dielectric const. of free space\n",
+ "eps2=120.0*10**12 #dielectric const. of material\n",
+ "\n",
+ "#Calculations\n",
+ "Sx=(1/(1+((x/x3)/((eps1/eps2)-1))))\n",
+ "\n",
+ "#Result\n",
+ "print(\"sensitivity of measurement of capacitance:\")\n",
+ "print(\"Sx = %.4f\"%Sx)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "sensitivity of measurement of capacitance:\n",
+ "Sx = -0.2978\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_5,pg 510"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find max gauge factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#if (delp/p)=0, the gauge factor is lam=1+2u\n",
+ "u=0.5 #max. value of poisson's ratio\n",
+ "\n",
+ "#Calculations\n",
+ "lam=1+(2*u)\n",
+ "\n",
+ "#Result\n",
+ "print(\"max. gauge factor:\")\n",
+ "print(\"lam = %.f\"%lam)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "max. gauge factor:\n",
+ "lam = 2\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_6,pg 510"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find Young modulus\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "lam=-150.0 #max. gauge factor\n",
+ "si=-9.25*10**-10 #resistivity change\n",
+ "mu=0.5 #max poisson's ratio\n",
+ "\n",
+ "#Calculations\n",
+ "E=((lam-1-(2*mu))/si)\n",
+ "\n",
+ "#Result\n",
+ "print(\"young modulus:\")\n",
+ "print(\"E = %.1f N/m^2\"%(E/10**10))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "young modulus:\n",
+ "E = 16.4 N/m^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_7,pg 510"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find capacitance of sensor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "d1=4*10**-2 #diameter of inner cylinder\n",
+ "d2=4.4*10**-2 #diameter of outer cylinder\n",
+ "h=2.2 #level of water\n",
+ "H=4.0 #height of tank\n",
+ "epsv=0.013*10**-5 #dielectric const. of medium(SI)\n",
+ "\n",
+ "#Calculations\n",
+ "eps1=((80.37*10**11)/((4*math.pi*10**8)**2))\n",
+ "C=(((H*epsv)+(h*(eps1-epsv)))/(2*math.log(d2/d1)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"capacitance of sensor:\")\n",
+ "print(\"C = %.f micro-F\"%(C*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "capacitance of sensor:\n",
+ "C = 60 micro-F\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_8,pg 511"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find ratio of collector currents\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "VobyT=0.04 #extrapolated bandgap voltage \n",
+ "RE1byRE2=(1/2.2) #ratio of emitter resistances of Q1,Q2\n",
+ "kBbyq=0.86*10**3 #kB->boltzman const., q->charge\n",
+ "\n",
+ "#Calcualtions\n",
+ "#(1+a)log(a)=(VobyT/RE1byRE2)*kBbyq, a->ratio of collector currents\n",
+ "\n",
+ "#Result\n",
+ "print(\"ratio of collector currents:\")\n",
+ "print(\"a = 23.094\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "ratio of collector currents:\n",
+ "a = 23.094\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_9,pg 511"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find normalized output\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#LVDT parameters\n",
+ "Rp=1.3\n",
+ "Rs=4\n",
+ "Lp=2.2*10**-3\n",
+ "Ls=13.1*10**-3\n",
+ "#M1-M2 varies linearly with displacement x, being maximum 0.4 cm\n",
+ "#when M1-M2=4mH so that k=(4/0.4)=10mH/cm\n",
+ "k=10#*10**-3\n",
+ "f=50.0 #frequency\n",
+ "\n",
+ "#Calculations\n",
+ "w=2*math.pi*f \n",
+ "tp=(Rp/Lp)\n",
+ "N=((w*k/Rp)/(math.sqrt(1+(w**2)*(tp**2))))\n",
+ "phi=(math.pi/2)-math.atan(w*Lp/Rp)\n",
+ "phi=phi*(180/math.pi)\n",
+ "phi = 90 -phi\n",
+ "#Result\n",
+ "print(\"normalized output:\")\n",
+ "print(\"N = %.4f V/V/cm\\n\"%N)\n",
+ "print(\"phase angle:\")\n",
+ "print(\"phi = %.2f\"%phi)\n",
+ "#Answer do not match with the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "normalized output:\n",
+ "N = 0.0130 V/V/cm\n",
+ "\n",
+ "phase angle:\n",
+ "phi = 28.00\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_10,pg 511\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find load voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#for barium titanate, g cost. is taken as 0.04Vm/N. (it varies depending in composition and processing)\n",
+ "t=1.3*10**-3 #thickness\n",
+ "g=0.04 #const.\n",
+ "f=2.2*9.8 #force\n",
+ "w=0.4 #width\n",
+ "l=0.4 #length\n",
+ "p=13.75 #pressure\n",
+ "\n",
+ "#Calculations\n",
+ "Vo=g*t*p*98076.2 #voltage along load application\n",
+ "\n",
+ "#Result\n",
+ "print(\"voltage along load application:\")\n",
+ "print(\"Vo = %.2f V\"%Vo)\n",
+ "#Answer in the book is wrong"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "voltage along load application:\n",
+ "Vo = 70.12 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_11,pg 512"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find error and senstivity parameters\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#ADC outputs counts\n",
+ "N11=130.0\n",
+ "N22=229.0\n",
+ "N12=220.0\n",
+ "N21=139.0\n",
+ "#variable values\n",
+ "v1=4\n",
+ "v2=6.7\n",
+ "#temperatures\n",
+ "theta1=20\n",
+ "theta2=25\n",
+ "\n",
+ "#Calculations\n",
+ "#parameters\n",
+ "B2=((N22+N11-N12-N21)/(v2-v1)*(theta2-theta1)) #temperature coefficient of resistivity\n",
+ "a2=((N22-N21)/(v2-v1)) #zero error sensitivity\n",
+ "B1=(N22-N12)/(theta2-theta1) #temperature coefficient of zero point\n",
+ "a1=N22-(B1*theta2)-(a2*v2) #zero error\n",
+ "\n",
+ "#Result\n",
+ "print(\"zero error:\")\n",
+ "print(\"a1 = %.2f\\n\"%a1)\n",
+ "print(\"zero error sensitivity:\")\n",
+ "print(\"a2 = %.2f\\n\"%a2)\n",
+ "print(\"temperature coefficient of zero point:\")\n",
+ "print(\"B1 = %.2f\\n\"%B1)\n",
+ "print(\"temperature coefficient of resistivity:\")\n",
+ "print(\"B2 = %.2f\"%B2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "zero error:\n",
+ "a1 = -39.33\n",
+ "\n",
+ "zero error sensitivity:\n",
+ "a2 = 33.33\n",
+ "\n",
+ "temperature coefficient of zero point:\n",
+ "B1 = 1.80\n",
+ "\n",
+ "temperature coefficient of resistivity:\n",
+ "B2 = 0.00\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch14_1.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch14_1.ipynb new file mode 100755 index 00000000..da8a1301 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch14_1.ipynb @@ -0,0 +1,526 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 14 : Transducers And The Measurement System"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_1,pg 421"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find percentage change in resistance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "delVo=120*10**-3 #output voltage\n",
+ "Vs=12.0 #supply voltage\n",
+ "R=120.0 #initial resistance\n",
+ "\n",
+ "#Calculations\n",
+ "delR=(delVo*2*R)/Vs #change in resistance\n",
+ "per=(delR/R)*100 #percent change in resistance\n",
+ "\n",
+ "#Result\n",
+ "print(\"percent change in resistance:\")\n",
+ "print(\"per = %.f\"%per)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "percent change in resistance:\n",
+ "per = 2\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_2,pg 423"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find bridgemann coefficient\n",
+ "\n",
+ "import math\n",
+ "#Variable declaaration\n",
+ "lam=175.0 #gauge factor\n",
+ "mu=0.18 #poisson's ratio\n",
+ "E=18.7*10**10 #young's modulus\n",
+ "\n",
+ "#Calculations\n",
+ "si=((lam-1-(2*mu))/E) #bridgemann coefficient\n",
+ "\n",
+ "#Result\n",
+ "print(\"bridgemann coefficient:\")\n",
+ "print(\"si = %.2f * 10^-10 m^2/N\"%(math.floor(si*10**12)/100))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "bridgemann coefficient:\n",
+ "si = 9.28 * 10^-10 m^2/N\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_3,pg 428"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# pt100 RTD\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R4=10*10**3\n",
+ "Ro=-2.2*10**3 #output resistance\n",
+ "R2=R4-0.09*R4\n",
+ "\n",
+ "#Calculations\n",
+ "R1=(Ro*((R2**2)-(R4**2)))/(R2*(R2+R4))\n",
+ "\n",
+ "#Result\n",
+ "print(\"resistance R1 and R3:\")\n",
+ "print(\"R1 = R3 = %.1f ohm\"%(math.floor(R1*10)/10))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "resistance R1 and R3:\n",
+ "R1 = R3 = 217.5 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_4,pg 435"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# senstivity in measurement of capacitance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#assuming eps1=9.85*10^12\n",
+ "x=4.0 #separation between plates\n",
+ "x3=1.0 #thickness of dielectric\n",
+ "eps1=9.85*10**12 #dielectric const. of free space\n",
+ "eps2=120.0*10**12 #dielectric const. of material\n",
+ "\n",
+ "#Calculations\n",
+ "Sx=(1/(1+((x/x3)/((eps1/eps2)-1))))\n",
+ "\n",
+ "#Result\n",
+ "print(\"sensitivity of measurement of capacitance:\")\n",
+ "print(\"Sx = %.4f\"%Sx)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "sensitivity of measurement of capacitance:\n",
+ "Sx = -0.2978\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_5,pg 510"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find max gauge factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#if (delp/p)=0, the gauge factor is lam=1+2u\n",
+ "u=0.5 #max. value of poisson's ratio\n",
+ "\n",
+ "#Calculations\n",
+ "lam=1+(2*u)\n",
+ "\n",
+ "#Result\n",
+ "print(\"max. gauge factor:\")\n",
+ "print(\"lam = %.f\"%lam)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "max. gauge factor:\n",
+ "lam = 2\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_6,pg 510"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find Young modulus\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "lam=-150.0 #max. gauge factor\n",
+ "si=-9.25*10**-10 #resistivity change\n",
+ "mu=0.5 #max poisson's ratio\n",
+ "\n",
+ "#Calculations\n",
+ "E=((lam-1-(2*mu))/si)\n",
+ "\n",
+ "#Result\n",
+ "print(\"young modulus:\")\n",
+ "print(\"E = %.1f N/m^2\"%(E/10**10))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "young modulus:\n",
+ "E = 16.4 N/m^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_7,pg 510"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find capacitance of sensor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "d1=4*10**-2 #diameter of inner cylinder\n",
+ "d2=4.4*10**-2 #diameter of outer cylinder\n",
+ "h=2.2 #level of water\n",
+ "H=4.0 #height of tank\n",
+ "epsv=0.013*10**-5 #dielectric const. of medium(SI)\n",
+ "\n",
+ "#Calculations\n",
+ "eps1=((80.37*10**11)/((4*math.pi*10**8)**2))\n",
+ "C=(((H*epsv)+(h*(eps1-epsv)))/(2*math.log(d2/d1)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"capacitance of sensor:\")\n",
+ "print(\"C = %.f micro-F\"%(C*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "capacitance of sensor:\n",
+ "C = 60 micro-F\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_8,pg 511"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find ratio of collector currents\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "VobyT=0.04 #extrapolated bandgap voltage \n",
+ "RE1byRE2=(1/2.2) #ratio of emitter resistances of Q1,Q2\n",
+ "kBbyq=0.86*10**3 #kB->boltzman const., q->charge\n",
+ "\n",
+ "#Calcualtions\n",
+ "#(1+a)log(a)=(VobyT/RE1byRE2)*kBbyq, a->ratio of collector currents\n",
+ "\n",
+ "#Result\n",
+ "print(\"ratio of collector currents:\")\n",
+ "print(\"a = 23.094\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "ratio of collector currents:\n",
+ "a = 23.094\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_9,pg 511"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find normalized output\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#LVDT parameters\n",
+ "Rp=1.3\n",
+ "Rs=4\n",
+ "Lp=2.2*10**-3\n",
+ "Ls=13.1*10**-3\n",
+ "#M1-M2 varies linearly with displacement x, being maximum 0.4 cm\n",
+ "#when M1-M2=4mH so that k=(4/0.4)=10mH/cm\n",
+ "k=10#*10**-3\n",
+ "f=50.0 #frequency\n",
+ "\n",
+ "#Calculations\n",
+ "w=2*math.pi*f \n",
+ "tp=(Rp/Lp)\n",
+ "N=((w*k/Rp)/(math.sqrt(1+(w**2)*(tp**2))))\n",
+ "phi=(math.pi/2)-math.atan(w*Lp/Rp)\n",
+ "phi=phi*(180/math.pi)\n",
+ "phi = 90 -phi\n",
+ "#Result\n",
+ "print(\"normalized output:\")\n",
+ "print(\"N = %.4f V/V/cm\\n\"%N)\n",
+ "print(\"phase angle:\")\n",
+ "print(\"phi = %.2f\"%phi)\n",
+ "#Answer do not match with the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "normalized output:\n",
+ "N = 0.0130 V/V/cm\n",
+ "\n",
+ "phase angle:\n",
+ "phi = 28.00\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_10,pg 511\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find load voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#for barium titanate, g cost. is taken as 0.04Vm/N. (it varies depending in composition and processing)\n",
+ "t=1.3*10**-3 #thickness\n",
+ "g=0.04 #const.\n",
+ "f=2.2*9.8 #force\n",
+ "w=0.4 #width\n",
+ "l=0.4 #length\n",
+ "p=13.75 #pressure\n",
+ "\n",
+ "#Calculations\n",
+ "Vo=g*t*p*98076.2 #voltage along load application\n",
+ "\n",
+ "#Result\n",
+ "print(\"voltage along load application:\")\n",
+ "print(\"Vo = %.2f V\"%Vo)\n",
+ "#Answer in the book is wrong"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "voltage along load application:\n",
+ "Vo = 70.12 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_11,pg 512"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find error and senstivity parameters\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#ADC outputs counts\n",
+ "N11=130.0\n",
+ "N22=229.0\n",
+ "N12=220.0\n",
+ "N21=139.0\n",
+ "#variable values\n",
+ "v1=4\n",
+ "v2=6.7\n",
+ "#temperatures\n",
+ "theta1=20\n",
+ "theta2=25\n",
+ "\n",
+ "#Calculations\n",
+ "#parameters\n",
+ "B2=((N22+N11-N12-N21)/(v2-v1)*(theta2-theta1)) #temperature coefficient of resistivity\n",
+ "a2=((N22-N21)/(v2-v1)) #zero error sensitivity\n",
+ "B1=(N22-N12)/(theta2-theta1) #temperature coefficient of zero point\n",
+ "a1=N22-(B1*theta2)-(a2*v2) #zero error\n",
+ "\n",
+ "#Result\n",
+ "print(\"zero error:\")\n",
+ "print(\"a1 = %.2f\\n\"%a1)\n",
+ "print(\"zero error sensitivity:\")\n",
+ "print(\"a2 = %.2f\\n\"%a2)\n",
+ "print(\"temperature coefficient of zero point:\")\n",
+ "print(\"B1 = %.2f\\n\"%B1)\n",
+ "print(\"temperature coefficient of resistivity:\")\n",
+ "print(\"B2 = %.2f\"%B2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "zero error:\n",
+ "a1 = -39.33\n",
+ "\n",
+ "zero error sensitivity:\n",
+ "a2 = 33.33\n",
+ "\n",
+ "temperature coefficient of zero point:\n",
+ "B1 = 1.80\n",
+ "\n",
+ "temperature coefficient of resistivity:\n",
+ "B2 = 0.00\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch14_2.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch14_2.ipynb new file mode 100755 index 00000000..da8a1301 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch14_2.ipynb @@ -0,0 +1,526 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 14 : Transducers And The Measurement System"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_1,pg 421"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find percentage change in resistance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "delVo=120*10**-3 #output voltage\n",
+ "Vs=12.0 #supply voltage\n",
+ "R=120.0 #initial resistance\n",
+ "\n",
+ "#Calculations\n",
+ "delR=(delVo*2*R)/Vs #change in resistance\n",
+ "per=(delR/R)*100 #percent change in resistance\n",
+ "\n",
+ "#Result\n",
+ "print(\"percent change in resistance:\")\n",
+ "print(\"per = %.f\"%per)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "percent change in resistance:\n",
+ "per = 2\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_2,pg 423"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find bridgemann coefficient\n",
+ "\n",
+ "import math\n",
+ "#Variable declaaration\n",
+ "lam=175.0 #gauge factor\n",
+ "mu=0.18 #poisson's ratio\n",
+ "E=18.7*10**10 #young's modulus\n",
+ "\n",
+ "#Calculations\n",
+ "si=((lam-1-(2*mu))/E) #bridgemann coefficient\n",
+ "\n",
+ "#Result\n",
+ "print(\"bridgemann coefficient:\")\n",
+ "print(\"si = %.2f * 10^-10 m^2/N\"%(math.floor(si*10**12)/100))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "bridgemann coefficient:\n",
+ "si = 9.28 * 10^-10 m^2/N\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_3,pg 428"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# pt100 RTD\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R4=10*10**3\n",
+ "Ro=-2.2*10**3 #output resistance\n",
+ "R2=R4-0.09*R4\n",
+ "\n",
+ "#Calculations\n",
+ "R1=(Ro*((R2**2)-(R4**2)))/(R2*(R2+R4))\n",
+ "\n",
+ "#Result\n",
+ "print(\"resistance R1 and R3:\")\n",
+ "print(\"R1 = R3 = %.1f ohm\"%(math.floor(R1*10)/10))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "resistance R1 and R3:\n",
+ "R1 = R3 = 217.5 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_4,pg 435"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# senstivity in measurement of capacitance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#assuming eps1=9.85*10^12\n",
+ "x=4.0 #separation between plates\n",
+ "x3=1.0 #thickness of dielectric\n",
+ "eps1=9.85*10**12 #dielectric const. of free space\n",
+ "eps2=120.0*10**12 #dielectric const. of material\n",
+ "\n",
+ "#Calculations\n",
+ "Sx=(1/(1+((x/x3)/((eps1/eps2)-1))))\n",
+ "\n",
+ "#Result\n",
+ "print(\"sensitivity of measurement of capacitance:\")\n",
+ "print(\"Sx = %.4f\"%Sx)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "sensitivity of measurement of capacitance:\n",
+ "Sx = -0.2978\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_5,pg 510"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find max gauge factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#if (delp/p)=0, the gauge factor is lam=1+2u\n",
+ "u=0.5 #max. value of poisson's ratio\n",
+ "\n",
+ "#Calculations\n",
+ "lam=1+(2*u)\n",
+ "\n",
+ "#Result\n",
+ "print(\"max. gauge factor:\")\n",
+ "print(\"lam = %.f\"%lam)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "max. gauge factor:\n",
+ "lam = 2\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_6,pg 510"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find Young modulus\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "lam=-150.0 #max. gauge factor\n",
+ "si=-9.25*10**-10 #resistivity change\n",
+ "mu=0.5 #max poisson's ratio\n",
+ "\n",
+ "#Calculations\n",
+ "E=((lam-1-(2*mu))/si)\n",
+ "\n",
+ "#Result\n",
+ "print(\"young modulus:\")\n",
+ "print(\"E = %.1f N/m^2\"%(E/10**10))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "young modulus:\n",
+ "E = 16.4 N/m^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_7,pg 510"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find capacitance of sensor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "d1=4*10**-2 #diameter of inner cylinder\n",
+ "d2=4.4*10**-2 #diameter of outer cylinder\n",
+ "h=2.2 #level of water\n",
+ "H=4.0 #height of tank\n",
+ "epsv=0.013*10**-5 #dielectric const. of medium(SI)\n",
+ "\n",
+ "#Calculations\n",
+ "eps1=((80.37*10**11)/((4*math.pi*10**8)**2))\n",
+ "C=(((H*epsv)+(h*(eps1-epsv)))/(2*math.log(d2/d1)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"capacitance of sensor:\")\n",
+ "print(\"C = %.f micro-F\"%(C*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "capacitance of sensor:\n",
+ "C = 60 micro-F\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_8,pg 511"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find ratio of collector currents\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "VobyT=0.04 #extrapolated bandgap voltage \n",
+ "RE1byRE2=(1/2.2) #ratio of emitter resistances of Q1,Q2\n",
+ "kBbyq=0.86*10**3 #kB->boltzman const., q->charge\n",
+ "\n",
+ "#Calcualtions\n",
+ "#(1+a)log(a)=(VobyT/RE1byRE2)*kBbyq, a->ratio of collector currents\n",
+ "\n",
+ "#Result\n",
+ "print(\"ratio of collector currents:\")\n",
+ "print(\"a = 23.094\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "ratio of collector currents:\n",
+ "a = 23.094\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_9,pg 511"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find normalized output\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#LVDT parameters\n",
+ "Rp=1.3\n",
+ "Rs=4\n",
+ "Lp=2.2*10**-3\n",
+ "Ls=13.1*10**-3\n",
+ "#M1-M2 varies linearly with displacement x, being maximum 0.4 cm\n",
+ "#when M1-M2=4mH so that k=(4/0.4)=10mH/cm\n",
+ "k=10#*10**-3\n",
+ "f=50.0 #frequency\n",
+ "\n",
+ "#Calculations\n",
+ "w=2*math.pi*f \n",
+ "tp=(Rp/Lp)\n",
+ "N=((w*k/Rp)/(math.sqrt(1+(w**2)*(tp**2))))\n",
+ "phi=(math.pi/2)-math.atan(w*Lp/Rp)\n",
+ "phi=phi*(180/math.pi)\n",
+ "phi = 90 -phi\n",
+ "#Result\n",
+ "print(\"normalized output:\")\n",
+ "print(\"N = %.4f V/V/cm\\n\"%N)\n",
+ "print(\"phase angle:\")\n",
+ "print(\"phi = %.2f\"%phi)\n",
+ "#Answer do not match with the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "normalized output:\n",
+ "N = 0.0130 V/V/cm\n",
+ "\n",
+ "phase angle:\n",
+ "phi = 28.00\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_10,pg 511\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find load voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#for barium titanate, g cost. is taken as 0.04Vm/N. (it varies depending in composition and processing)\n",
+ "t=1.3*10**-3 #thickness\n",
+ "g=0.04 #const.\n",
+ "f=2.2*9.8 #force\n",
+ "w=0.4 #width\n",
+ "l=0.4 #length\n",
+ "p=13.75 #pressure\n",
+ "\n",
+ "#Calculations\n",
+ "Vo=g*t*p*98076.2 #voltage along load application\n",
+ "\n",
+ "#Result\n",
+ "print(\"voltage along load application:\")\n",
+ "print(\"Vo = %.2f V\"%Vo)\n",
+ "#Answer in the book is wrong"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "voltage along load application:\n",
+ "Vo = 70.12 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example14_11,pg 512"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find error and senstivity parameters\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#ADC outputs counts\n",
+ "N11=130.0\n",
+ "N22=229.0\n",
+ "N12=220.0\n",
+ "N21=139.0\n",
+ "#variable values\n",
+ "v1=4\n",
+ "v2=6.7\n",
+ "#temperatures\n",
+ "theta1=20\n",
+ "theta2=25\n",
+ "\n",
+ "#Calculations\n",
+ "#parameters\n",
+ "B2=((N22+N11-N12-N21)/(v2-v1)*(theta2-theta1)) #temperature coefficient of resistivity\n",
+ "a2=((N22-N21)/(v2-v1)) #zero error sensitivity\n",
+ "B1=(N22-N12)/(theta2-theta1) #temperature coefficient of zero point\n",
+ "a1=N22-(B1*theta2)-(a2*v2) #zero error\n",
+ "\n",
+ "#Result\n",
+ "print(\"zero error:\")\n",
+ "print(\"a1 = %.2f\\n\"%a1)\n",
+ "print(\"zero error sensitivity:\")\n",
+ "print(\"a2 = %.2f\\n\"%a2)\n",
+ "print(\"temperature coefficient of zero point:\")\n",
+ "print(\"B1 = %.2f\\n\"%B1)\n",
+ "print(\"temperature coefficient of resistivity:\")\n",
+ "print(\"B2 = %.2f\"%B2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "zero error:\n",
+ "a1 = -39.33\n",
+ "\n",
+ "zero error sensitivity:\n",
+ "a2 = 33.33\n",
+ "\n",
+ "temperature coefficient of zero point:\n",
+ "B1 = 1.80\n",
+ "\n",
+ "temperature coefficient of resistivity:\n",
+ "B2 = 0.00\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch15.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch15.ipynb new file mode 100755 index 00000000..69a1c3c1 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch15.ipynb @@ -0,0 +1,240 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 15 : Fibre Optics Sensors And Instrumentation"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example15_1,pg 470"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find increamental phase\n",
+ "\n",
+ "import math\n",
+ "#variable declaration\n",
+ "n1=1.48 #refractive index of fibre\n",
+ "mu=0.2 #poisson's ratio\n",
+ "p=2.2*10**2 #pressure applied\n",
+ "lam=690.0*10**-9 #laser beam wavelength\n",
+ "Y=2.2*10**11 #young's modulus\n",
+ "\n",
+ "#Calcaulation\n",
+ "delphi=((4*math.pi*n1*mu*p)/(lam*Y))\n",
+ "\n",
+ "#Result\n",
+ "print(\"increamental phase:\")\n",
+ "print(\"delphi = %.6f rad\"%delphi)\n",
+ "#Answer is slightly different"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "increamental phase:\n",
+ "delphi = 0.005391 rad\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example15_2,pg 474"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find additional length travelled\n",
+ "\n",
+ "import math\n",
+ "#Variable declartion\n",
+ "r= 9 #radius of fibre loop\n",
+ "a=math.pi*((r/2)**2) #area of fibre loop\n",
+ "Q=1.0 #linear velocity(cm/s)\n",
+ "Co=3*10**8 #velocity of light(cm/s)\n",
+ "\n",
+ "#Calculations\n",
+ "delL=((4*a*Q)/(Co)) #additional length travelled\n",
+ "\n",
+ "#Results\n",
+ "print(\"additional length travelled:\")\n",
+ "print(\"delL = %.1f * 10^-8 cm\"%(delL*10**8))\n",
+ "#Answer is not matching with book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "additional length travelled:\n",
+ "delL = 67.0 * 10^-8 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example15_3,pg 512\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find interacting length\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#(Po1/Po2)=1/2 and Po1+Po2=3Po2=Pi\n",
+ "Po2byPi=1.0/3.0 #(Po2/Pi)\n",
+ "\n",
+ "#Calculations\n",
+ "kL=math.acos(math.sqrt(Po2byPi)) #k->coupling coefficient\n",
+ "L=kL #L=kL/k L->interacting length\n",
+ "\n",
+ "#Result\n",
+ "print(\"interacting length:\")\n",
+ "print(\"L = %f/k\"%L)\n",
+ "# answer is slightly different than book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "interacting length:\n",
+ "0.57735026919\n",
+ "L = 0.955133/k\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example15_4,pg 512\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# wavelength suitable for laser light\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "We=7.6*10**-5 #speed od gyro\n",
+ "L=490.0 #length\n",
+ "c=3*10**8 #speed of light \n",
+ "delphi=7.69*10**-5 #phase shift\n",
+ "d=0.094 \n",
+ "\n",
+ "#Calculations\n",
+ "lam=((2*math.pi*L*d*We)/(c*delphi)) #wavelength of laser light\n",
+ "\n",
+ "#Result\n",
+ "print(\"wavelength of laser light:\")\n",
+ "print(\"lam = %.f *10^-9 m\"%(lam*10**9))\n",
+ "#Answer isslightly different than book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "wavelength of laser light:\n",
+ "lam = 953 *10^-9 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example15_5,pg 513"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find rate of change of RI wrt T\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#(delphi/delT)=(2pi/lam)(n*(delL/delT)+L*(deln/delT))=(deln/delT)\n",
+ "lam=635.0*10**-9 #wavelength of light beam\n",
+ "delphi=139.0 #phase angle\n",
+ "delL=0.49*10**-6 #change in length\n",
+ "n=1.48 #R.I of fibre\n",
+ "\n",
+ "#Calculations\n",
+ "k=((lam*delphi)/(2*math.pi))-(delL*n) #//k=(deln/delT), rate of change of R.I w.r.t T\n",
+ "\n",
+ "#Result\n",
+ "print(\"rate of change of R.I w.r.t T:\")\n",
+ "print(\"k = %.2f * 10^-6/\u00b0C\"%(k*10**6))\n",
+ "# Answer is nnot matching to book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "rate of change of R.I w.r.t T:\n",
+ "k = 13.32 * 10^-6/\u00b0C\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch15_1.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch15_1.ipynb new file mode 100755 index 00000000..f782a842 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch15_1.ipynb @@ -0,0 +1,239 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 15 : Fibre Optics Sensors And Instrumentation"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example15_1,pg 470"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find increamental phase\n",
+ "\n",
+ "import math\n",
+ "#variable declaration\n",
+ "n1=1.48 #refractive index of fibre\n",
+ "mu=0.2 #poisson's ratio\n",
+ "p=2.2*10**2 #pressure applied\n",
+ "lam=690.0*10**-9 #laser beam wavelength\n",
+ "Y=2.2*10**11 #young's modulus\n",
+ "\n",
+ "#Calcaulation\n",
+ "delphi=((4*math.pi*n1*mu*p)/(lam*Y))\n",
+ "\n",
+ "#Result\n",
+ "print(\"increamental phase:\")\n",
+ "print(\"delphi = %.6f rad\"%delphi)\n",
+ "#Answer is slightly different"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "increamental phase:\n",
+ "delphi = 0.005391 rad\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example15_2,pg 474"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find additional length travelled\n",
+ "\n",
+ "import math\n",
+ "#Variable declartion\n",
+ "r= 9 #radius of fibre loop\n",
+ "a=math.pi*((r/2)**2) #area of fibre loop\n",
+ "Q=1.0 #linear velocity(cm/s)\n",
+ "Co=3*10**8 #velocity of light(cm/s)\n",
+ "\n",
+ "#Calculations\n",
+ "delL=((4*a*Q)/(Co)) #additional length travelled\n",
+ "\n",
+ "#Results\n",
+ "print(\"additional length travelled:\")\n",
+ "print(\"delL = %.1f * 10^-8 cm\"%(delL*10**8))\n",
+ "#Answer is not matching with book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "additional length travelled:\n",
+ "delL = 67.0 * 10^-8 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example15_3,pg 512\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find interacting length\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#(Po1/Po2)=1/2 and Po1+Po2=3Po2=Pi\n",
+ "Po2byPi=1.0/3.0 #(Po2/Pi)\n",
+ "\n",
+ "#Calculations\n",
+ "kL=math.acos(math.sqrt(Po2byPi)) #k->coupling coefficient\n",
+ "L=kL #L=kL/k L->interacting length\n",
+ "\n",
+ "#Result\n",
+ "print(\"interacting length:\")\n",
+ "print(\"L = %.4f/k\"%L)\n",
+ "# answer is slightly different than book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "interacting length:\n",
+ "L = 0.9553/k\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example15_4,pg 512\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# wavelength suitable for laser light\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "We=7.6*10**-5 #speed od gyro\n",
+ "L=490.0 #length\n",
+ "c=3*10**8 #speed of light \n",
+ "delphi=7.69*10**-5 #phase shift\n",
+ "d=0.094 \n",
+ "\n",
+ "#Calculations\n",
+ "lam=((2*math.pi*L*d*We)/(c*delphi)) #wavelength of laser light\n",
+ "\n",
+ "#Result\n",
+ "print(\"wavelength of laser light:\")\n",
+ "print(\"lam = %.f *10^-9 m\"%(lam*10**9))\n",
+ "#Answer isslightly different than book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "wavelength of laser light:\n",
+ "lam = 953 *10^-9 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example15_5,pg 513"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find rate of change of RI wrt T\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#(delphi/delT)=(2pi/lam)(n*(delL/delT)+L*(deln/delT))=(deln/delT)\n",
+ "lam=635.0*10**-9 #wavelength of light beam\n",
+ "delphi=139.0 #phase angle\n",
+ "delL=0.49*10**-6 #change in length\n",
+ "n=1.48 #R.I of fibre\n",
+ "\n",
+ "#Calculations\n",
+ "k=((lam*delphi)/(2*math.pi))-(delL*n) #//k=(deln/delT), rate of change of R.I w.r.t T\n",
+ "\n",
+ "#Result\n",
+ "print(\"rate of change of R.I w.r.t T:\")\n",
+ "print(\"k = %.2f * 10^-6/\u00b0C\"%(k*10**6))\n",
+ "# Answer is nnot matching to book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "rate of change of R.I w.r.t T:\n",
+ "k = 13.32 * 10^-6/\u00b0C\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch15_2.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch15_2.ipynb new file mode 100755 index 00000000..f782a842 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch15_2.ipynb @@ -0,0 +1,239 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 15 : Fibre Optics Sensors And Instrumentation"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example15_1,pg 470"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find increamental phase\n",
+ "\n",
+ "import math\n",
+ "#variable declaration\n",
+ "n1=1.48 #refractive index of fibre\n",
+ "mu=0.2 #poisson's ratio\n",
+ "p=2.2*10**2 #pressure applied\n",
+ "lam=690.0*10**-9 #laser beam wavelength\n",
+ "Y=2.2*10**11 #young's modulus\n",
+ "\n",
+ "#Calcaulation\n",
+ "delphi=((4*math.pi*n1*mu*p)/(lam*Y))\n",
+ "\n",
+ "#Result\n",
+ "print(\"increamental phase:\")\n",
+ "print(\"delphi = %.6f rad\"%delphi)\n",
+ "#Answer is slightly different"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "increamental phase:\n",
+ "delphi = 0.005391 rad\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example15_2,pg 474"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find additional length travelled\n",
+ "\n",
+ "import math\n",
+ "#Variable declartion\n",
+ "r= 9 #radius of fibre loop\n",
+ "a=math.pi*((r/2)**2) #area of fibre loop\n",
+ "Q=1.0 #linear velocity(cm/s)\n",
+ "Co=3*10**8 #velocity of light(cm/s)\n",
+ "\n",
+ "#Calculations\n",
+ "delL=((4*a*Q)/(Co)) #additional length travelled\n",
+ "\n",
+ "#Results\n",
+ "print(\"additional length travelled:\")\n",
+ "print(\"delL = %.1f * 10^-8 cm\"%(delL*10**8))\n",
+ "#Answer is not matching with book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "additional length travelled:\n",
+ "delL = 67.0 * 10^-8 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example15_3,pg 512\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find interacting length\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#(Po1/Po2)=1/2 and Po1+Po2=3Po2=Pi\n",
+ "Po2byPi=1.0/3.0 #(Po2/Pi)\n",
+ "\n",
+ "#Calculations\n",
+ "kL=math.acos(math.sqrt(Po2byPi)) #k->coupling coefficient\n",
+ "L=kL #L=kL/k L->interacting length\n",
+ "\n",
+ "#Result\n",
+ "print(\"interacting length:\")\n",
+ "print(\"L = %.4f/k\"%L)\n",
+ "# answer is slightly different than book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "interacting length:\n",
+ "L = 0.9553/k\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example15_4,pg 512\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# wavelength suitable for laser light\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "We=7.6*10**-5 #speed od gyro\n",
+ "L=490.0 #length\n",
+ "c=3*10**8 #speed of light \n",
+ "delphi=7.69*10**-5 #phase shift\n",
+ "d=0.094 \n",
+ "\n",
+ "#Calculations\n",
+ "lam=((2*math.pi*L*d*We)/(c*delphi)) #wavelength of laser light\n",
+ "\n",
+ "#Result\n",
+ "print(\"wavelength of laser light:\")\n",
+ "print(\"lam = %.f *10^-9 m\"%(lam*10**9))\n",
+ "#Answer isslightly different than book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "wavelength of laser light:\n",
+ "lam = 953 *10^-9 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example15_5,pg 513"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find rate of change of RI wrt T\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#(delphi/delT)=(2pi/lam)(n*(delL/delT)+L*(deln/delT))=(deln/delT)\n",
+ "lam=635.0*10**-9 #wavelength of light beam\n",
+ "delphi=139.0 #phase angle\n",
+ "delL=0.49*10**-6 #change in length\n",
+ "n=1.48 #R.I of fibre\n",
+ "\n",
+ "#Calculations\n",
+ "k=((lam*delphi)/(2*math.pi))-(delL*n) #//k=(deln/delT), rate of change of R.I w.r.t T\n",
+ "\n",
+ "#Result\n",
+ "print(\"rate of change of R.I w.r.t T:\")\n",
+ "print(\"k = %.2f * 10^-6/\u00b0C\"%(k*10**6))\n",
+ "# Answer is nnot matching to book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "rate of change of R.I w.r.t T:\n",
+ "k = 13.32 * 10^-6/\u00b0C\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch1_1.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch1_1.ipynb new file mode 100755 index 00000000..5c780e84 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch1_1.ipynb @@ -0,0 +1,404 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 1 : Basic Concepts"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_1,pg 481"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# unknown resistance(refer fig. 1.4(a))\n",
+ "\n",
+ "import math\n",
+ "#VAriable declaration\n",
+ "Ir=10*10**-3 #current drawn by resistor\n",
+ "Vr=100.0 #voltage across resistor\n",
+ "Rv=40*10**3 #voltmeter resistance\n",
+ "\n",
+ "#Calcualtions\n",
+ "Ru=(Vr/Ir)*(1/(1-(Vr/(Ir*Rv)))) \n",
+ "\n",
+ "#Result\n",
+ "print(\"output resistance:\")\n",
+ "print(\"Ru = %d ohm\"%Ru)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output resistance:\n",
+ "Ru = 13333 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_2,pg 481"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# unknown resistance(refer fig. 1.4(b))\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Ir=10*10**-3 #current drawn by resistor\n",
+ "Vr=100.0 #voltage across resistor\n",
+ "Rv=40*10**3 #voltmeter resistance\n",
+ "Ra=1.0 #ammeter resistance\n",
+ "\n",
+ "#Calculations\n",
+ "Ru=(Rv/Ir)-Ra\n",
+ "\n",
+ "#Result\n",
+ "print(\"output resistance:\")\n",
+ "print(\"Ru = %.2f ohm\"%Ru)\n",
+ "# Answer in the book is in k-ohm"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output resistance:\n",
+ "Ru=3999999.00 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_3,pg 481"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find ammeter reading\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Rv=40*10**3 #voltmeter resistance\n",
+ "Ra=1.0 #ammeter resistance\n",
+ "Vr=40.0 #voltmeter reading\n",
+ "Ru=10*10**3 #unknown resistance\n",
+ "\n",
+ "#Calculations\n",
+ "Ir=(Vr*(Rv+Ru))/(Ru*Rv)\n",
+ "Ir1=(Vr/(Ru+Ra))\n",
+ "\n",
+ "#Result\n",
+ "print(\"ammeter reading case1:\")\n",
+ "print(\"Ir = %d mA\"%(Ir*10**3))\n",
+ "print(\"\\nammeter reading case2:\")\n",
+ "print(\"Ir1 = %.d mA\"%(Ir1*10**3))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "ammeter reading case1:\n",
+ "Ir = 5 mA\n",
+ "\n",
+ "ammeter reading case2:\n",
+ "Ir1 = 3 mA\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_4,pg 482"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# unknown resistance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vs=3.0 #supply voltage\n",
+ "Vu=2.75 #voltmeter reading\n",
+ "Rp=10*10**3 #parallel resistance\n",
+ "\n",
+ "#Calculations\n",
+ "Ru=Rp*((Vs/Vu)-1)\n",
+ "\n",
+ "#Result\n",
+ "print(\"unknown resistance:\")\n",
+ "print(\"Ru = %.2f ohm\"%Ru)\n",
+ "#Answer in the book is not matching"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "unknown resistance:\n",
+ "Ru=909.09 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_5,pg 482"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Find input vlotage\n",
+ "\n",
+ "#with input voltage exceding 2Vd,diodes conduct and the voltage divider circuit with diodes can allow only a Vi given by Vi=2Vd\n",
+ "\n",
+ "#Result\n",
+ "print(\"input voltage to amplifier:\")\n",
+ "print(\"Vi = 2*Vd\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "input voltage to amplifier:\n",
+ "Vi = 2*Vd\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_6,pg 482"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find shunt resistance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Rm=1000.0 #meter resistance\n",
+ "Is=900*10**-6 #shunt current\n",
+ "Vm=100*10**-3 #drop across meter\n",
+ "\n",
+ "#Result\n",
+ "Rs=Vm/Is\n",
+ "It=1*10**-3\n",
+ "#Is=It*(Rm/(Rs+Rm))\n",
+ "Rs=(Rm*(It-Is))/Is\n",
+ "\n",
+ "#Result\n",
+ "print(\"shunt resistance:\")\n",
+ "print(\"Rs = %.1f ohm\"%Rs)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "shunt resistance:\n",
+ "Rs = 111.1 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_7,pg 483"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find series resistor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "If=100*10**-6 #full scale current\n",
+ "Rm=1000.0 #meter resistance\n",
+ "Vf=10.0 #full scale voltage\n",
+ "\n",
+ "#Calculations\n",
+ "Rs=(Vf/If)-Rm\n",
+ "\n",
+ "#Result\n",
+ "print(\"series resistance:\")\n",
+ "print(\"Rs=%.0f ohm\"%Rs)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "series resistance:\n",
+ "Rs=99000 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_8,pg 483"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# sensitivity\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "If=100*10**-6 # Current\n",
+ "\n",
+ "#Calculations\n",
+ "S=1/If\n",
+ "\n",
+ "#Result\n",
+ "print(\"sensitivity:\")\n",
+ "print(\"S = %.2f ohm/volt\"%S)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "sensitivity:\n",
+ "S = 10000.00 ohm/volt\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_9,pg 483"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# error in measurment\n",
+ "\n",
+ "import math\n",
+ "# Variable declaration\n",
+ "\n",
+ "#assume that the voltmeter full scale reading is 12V which gives its resistance as 1.2*10^6 ohm \n",
+ "#which is in parallel with 10*10^6 ohm making as equivalent of Rq given as\n",
+ "R=1.2*10**6 #voltmeter resistance\n",
+ "R1=10*10**6 #voltage divider resistance\n",
+ "Vin=12.0 #input voltage to divider network\n",
+ "Rs=4*10**6 # series resistance\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "Rq=(R*R1)/(R+R1)\n",
+ "Vq=(Rq*Vin)/(Rq+Rs) #voltage across equivalent combination\n",
+ "Va=(R1*Vin)/(R1+Rs) #actual volatge\n",
+ "er=(Vq-Va)/Va #error\n",
+ "\n",
+ "#Result\n",
+ "print(\"error in measurement:\")\n",
+ "print(\"\\ner = %.3f i.e %.1f%%\"%(er,er*100))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "error in measurement:\n",
+ "\n",
+ "er = -0.704 i.e -70.4%\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch1_2.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch1_2.ipynb new file mode 100755 index 00000000..5c780e84 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch1_2.ipynb @@ -0,0 +1,404 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 1 : Basic Concepts"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_1,pg 481"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# unknown resistance(refer fig. 1.4(a))\n",
+ "\n",
+ "import math\n",
+ "#VAriable declaration\n",
+ "Ir=10*10**-3 #current drawn by resistor\n",
+ "Vr=100.0 #voltage across resistor\n",
+ "Rv=40*10**3 #voltmeter resistance\n",
+ "\n",
+ "#Calcualtions\n",
+ "Ru=(Vr/Ir)*(1/(1-(Vr/(Ir*Rv)))) \n",
+ "\n",
+ "#Result\n",
+ "print(\"output resistance:\")\n",
+ "print(\"Ru = %d ohm\"%Ru)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output resistance:\n",
+ "Ru = 13333 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_2,pg 481"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# unknown resistance(refer fig. 1.4(b))\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Ir=10*10**-3 #current drawn by resistor\n",
+ "Vr=100.0 #voltage across resistor\n",
+ "Rv=40*10**3 #voltmeter resistance\n",
+ "Ra=1.0 #ammeter resistance\n",
+ "\n",
+ "#Calculations\n",
+ "Ru=(Rv/Ir)-Ra\n",
+ "\n",
+ "#Result\n",
+ "print(\"output resistance:\")\n",
+ "print(\"Ru = %.2f ohm\"%Ru)\n",
+ "# Answer in the book is in k-ohm"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output resistance:\n",
+ "Ru=3999999.00 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_3,pg 481"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find ammeter reading\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Rv=40*10**3 #voltmeter resistance\n",
+ "Ra=1.0 #ammeter resistance\n",
+ "Vr=40.0 #voltmeter reading\n",
+ "Ru=10*10**3 #unknown resistance\n",
+ "\n",
+ "#Calculations\n",
+ "Ir=(Vr*(Rv+Ru))/(Ru*Rv)\n",
+ "Ir1=(Vr/(Ru+Ra))\n",
+ "\n",
+ "#Result\n",
+ "print(\"ammeter reading case1:\")\n",
+ "print(\"Ir = %d mA\"%(Ir*10**3))\n",
+ "print(\"\\nammeter reading case2:\")\n",
+ "print(\"Ir1 = %.d mA\"%(Ir1*10**3))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "ammeter reading case1:\n",
+ "Ir = 5 mA\n",
+ "\n",
+ "ammeter reading case2:\n",
+ "Ir1 = 3 mA\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_4,pg 482"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# unknown resistance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vs=3.0 #supply voltage\n",
+ "Vu=2.75 #voltmeter reading\n",
+ "Rp=10*10**3 #parallel resistance\n",
+ "\n",
+ "#Calculations\n",
+ "Ru=Rp*((Vs/Vu)-1)\n",
+ "\n",
+ "#Result\n",
+ "print(\"unknown resistance:\")\n",
+ "print(\"Ru = %.2f ohm\"%Ru)\n",
+ "#Answer in the book is not matching"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "unknown resistance:\n",
+ "Ru=909.09 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_5,pg 482"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Find input vlotage\n",
+ "\n",
+ "#with input voltage exceding 2Vd,diodes conduct and the voltage divider circuit with diodes can allow only a Vi given by Vi=2Vd\n",
+ "\n",
+ "#Result\n",
+ "print(\"input voltage to amplifier:\")\n",
+ "print(\"Vi = 2*Vd\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "input voltage to amplifier:\n",
+ "Vi = 2*Vd\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_6,pg 482"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find shunt resistance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Rm=1000.0 #meter resistance\n",
+ "Is=900*10**-6 #shunt current\n",
+ "Vm=100*10**-3 #drop across meter\n",
+ "\n",
+ "#Result\n",
+ "Rs=Vm/Is\n",
+ "It=1*10**-3\n",
+ "#Is=It*(Rm/(Rs+Rm))\n",
+ "Rs=(Rm*(It-Is))/Is\n",
+ "\n",
+ "#Result\n",
+ "print(\"shunt resistance:\")\n",
+ "print(\"Rs = %.1f ohm\"%Rs)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "shunt resistance:\n",
+ "Rs = 111.1 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_7,pg 483"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find series resistor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "If=100*10**-6 #full scale current\n",
+ "Rm=1000.0 #meter resistance\n",
+ "Vf=10.0 #full scale voltage\n",
+ "\n",
+ "#Calculations\n",
+ "Rs=(Vf/If)-Rm\n",
+ "\n",
+ "#Result\n",
+ "print(\"series resistance:\")\n",
+ "print(\"Rs=%.0f ohm\"%Rs)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "series resistance:\n",
+ "Rs=99000 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_8,pg 483"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# sensitivity\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "If=100*10**-6 # Current\n",
+ "\n",
+ "#Calculations\n",
+ "S=1/If\n",
+ "\n",
+ "#Result\n",
+ "print(\"sensitivity:\")\n",
+ "print(\"S = %.2f ohm/volt\"%S)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "sensitivity:\n",
+ "S = 10000.00 ohm/volt\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1_9,pg 483"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# error in measurment\n",
+ "\n",
+ "import math\n",
+ "# Variable declaration\n",
+ "\n",
+ "#assume that the voltmeter full scale reading is 12V which gives its resistance as 1.2*10^6 ohm \n",
+ "#which is in parallel with 10*10^6 ohm making as equivalent of Rq given as\n",
+ "R=1.2*10**6 #voltmeter resistance\n",
+ "R1=10*10**6 #voltage divider resistance\n",
+ "Vin=12.0 #input voltage to divider network\n",
+ "Rs=4*10**6 # series resistance\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "Rq=(R*R1)/(R+R1)\n",
+ "Vq=(Rq*Vin)/(Rq+Rs) #voltage across equivalent combination\n",
+ "Va=(R1*Vin)/(R1+Rs) #actual volatge\n",
+ "er=(Vq-Va)/Va #error\n",
+ "\n",
+ "#Result\n",
+ "print(\"error in measurement:\")\n",
+ "print(\"\\ner = %.3f i.e %.1f%%\"%(er,er*100))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "error in measurement:\n",
+ "\n",
+ "er = -0.704 i.e -70.4%\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch2.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch2.ipynb new file mode 100755 index 00000000..26ecb8a9 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch2.ipynb @@ -0,0 +1,547 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 2: Measurement Of Electrical Quantities"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_1,pg 23"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# output voltage \n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "ic=1*10**-3 #constant current source\n",
+ "Rf=15*10**3 #feedback resistance\n",
+ "Rs=10*10**3 #input resistance\n",
+ "Rx=1.0*10**3 #unknown resistance\n",
+ "R1=10.0 #unknown resistance\n",
+ "R2=1*10**3 #input resistance\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "# for fig. 2.7\n",
+ "Vo1=ic*Rf*(Rx/(1+(Rx*Rs))) #output voltage case-1\n",
+ "#for fig. 2.8\n",
+ "Vo2=ic*Rx*(R1/(1+R1*R2)) #output voltage case-2\n",
+ "\n",
+ "#Result\n",
+ "print(\"output voltage for case-1:\")\n",
+ "print(\"Vo1 = %.4f V\\n\"%Vo1)\n",
+ "print(\"output voltage for case-2:\")\n",
+ "print(\"Vo2 = %.0f mV\\n\"%(Vo2*10**3))\n",
+ "#Answer for case-1 is different in the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output voltage for case-1:\n",
+ "Vo1 = 0.0015 V\n",
+ "\n",
+ "output voltage for case-2:\n",
+ "Vo2 = 1 mV\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_2,pg 27"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find Ad CMRR and Acm\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "V1=5.0 #input-1\n",
+ "V2=5.0 #input-2\n",
+ "V12=50*10**-3 #difference input\n",
+ "Vo=2.0 #output voltage\n",
+ "acc=0.01 #accuracy\n",
+ "\n",
+ "#Calculations\n",
+ "Ad=(Vo/V12) #diffrential gain\n",
+ "#error at the output should be less than (2/100)V or 20mV.if common mode gain is the only source of error then \n",
+ "err=Vo*acc #error\n",
+ "Acm=(err/V1) #common mode gain\n",
+ "CMRR=20*math.log10(Ad/Acm) #common mode rejection ratio in dB\n",
+ "\n",
+ "#Result\n",
+ "print(\"diffrential gain:\")\n",
+ "print(\"Ad=%.1f \\n\"%Ad)\n",
+ "print(\"common mode gain:\")\n",
+ "print(\"Acm=%.4f \"%Acm)\n",
+ "print(\"\\nCMRR=%.1f dB\\n\"%CMRR)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "diffrential gain:\n",
+ "Ad=40.0 \n",
+ "\n",
+ "common mode gain:\n",
+ "Acm=0.0040 \n",
+ "\n",
+ "CMRR=80.0 dB\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_3,pg 484"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find full scale output and minimum input\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Aol=1.0*10**5 #open loop gain\n",
+ "R2=10.0*10**3 #Resistor R2\n",
+ "R3=10.0*10**3 #Resistor R3\n",
+ "R1=100*10**3 #input resistance\n",
+ "Vac=24.0 #maximum input\n",
+ "\n",
+ "#Calculations\n",
+ "Vo=(R2/R1)*Vac #output full scale\n",
+ "Vth=0.6 #threshold voltage\n",
+ "Vn=(Vth/Aol) #minimum input\n",
+ "\n",
+ "#Result\n",
+ "print(\"output FS voltage:\")\n",
+ "print(\"Vo = %.2f V\\n\"%Vo)\n",
+ "print(\"minimum input voltage:\")\n",
+ "print(\"Vn = %.1f micro-V\\n\"%(Vn*10**6))\n",
+ "#Answer for Vn is wrong in the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output FS voltage:\n",
+ "Vo = 2.40 V\n",
+ "\n",
+ "minimum input voltage:\n",
+ "Vn = 6.0 micro-V\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_4,pg 484"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# output voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vp=1.0 #peak input voltage\n",
+ "f=50.0 #frequency\n",
+ "#R1=R2\n",
+ "\n",
+ "#Calculations\n",
+ "#since halfwave rectification is done,integration gives the value\n",
+ "pi =math.floor(math.pi*100)/100\n",
+ "Vo=0.5*((2*Vp)/pi) #output voltage,pi=3.14 \n",
+ "\n",
+ "#Result\n",
+ "print(\"output voltage:\")\n",
+ "print(\"Vo = %.3f V\\n\"%Vo)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output voltage:\n",
+ "Vo = 0.318 V\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_5,pg 484"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find unknown resistance\n",
+ "\n",
+ "import math\n",
+ "#VBariable declaration\n",
+ "ic=0.1*10**-3 #constant current source\n",
+ "Vo=2.0 #output voltage\n",
+ "Rf=22.0*10**3 #feedback resistance\n",
+ "Rs=10.0*10**3 #input resistance\n",
+ "\n",
+ "#Calculations\n",
+ "Rx=(1/(((ic*Rf)/(Vo*Rs))-(1/Rs)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"unknown resistance:\")\n",
+ "print(\"Rx = %.0f k-ohm\\n\"%(Rx/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "unknown resistance:\n",
+ "Rx = 100 k-ohm\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_6,pg 484"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find CMRR\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "a=0.9 #parameter of diff. amplr.\n",
+ "b=1.1 #parameter of diff. amplr.\n",
+ "\n",
+ "#Calculations\n",
+ "CMRR=0.5*(((1+a)*b+(1+b)*a))/((1+a)*b-(1+b)*a)\n",
+ "\n",
+ "#Results\n",
+ "print(\"CMRR = %.2f\"%CMRR)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "CMRR = 9.95\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_7,pg 485"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# tolerance in parameters\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "CMRR=10.0*10**4 #common mode rejection ratio\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "#set a=beta+k1*delbeta and b=beta(-/+)k2*delbeta\n",
+ "#CMRR=0.5*((4(+/-)3*delbeta*(k1-k2))/((+/-)delbeta*(k1-k2)))\n",
+ "#CMRR=0.5*((4(+/-)3*(a1-a2))/((+/-)(a1-a2)))\n",
+ "#a1->k1*delbeta, a2->k2*delbeta\n",
+ "\n",
+ "delalpha=(2/CMRR) #a1-a2=delalpha\n",
+ "\n",
+ "#Result\n",
+ "print(\"tolerance in parameters:\")\n",
+ "print(\"delalpha = %.0f * 10^-5 \"%(delalpha*10**5))\n",
+ "print(\"Therefore, if a varies by 1 percent, b should not vary more than 2*10^-3 percent of variation of a.\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "tolerance in parameters:\n",
+ "delalpha = 2 * 10^-5 \n",
+ "Therefore, if a varies by 1 percent, b should not vary more than 2*10^-3 percent of variation of a.\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_8,pg 485"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# output voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R1=10*10**3 #resistor R1\n",
+ "R2=10*10**3 #resistor R2\n",
+ "V1=1.0 #input voltage-1\n",
+ "V2=1.0 #input voltage-2\n",
+ "R31=10.0*10**3 #Resistor R3,case-1\n",
+ "R32=100.0*10**3 #Resistor R3,case-2\n",
+ "R33=1000.0*10**3 #Resistor R3,case-3\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "Vo1=((1+(R2/R1)+(R2/R31))*V1)-(R2/R1)*V2\n",
+ "Vo2=((1+(R2/R1)+(R2/R32))*V1)-(R2/R1)*V2\n",
+ "Vo3=((1+(R2/R1)+(R2/R33))*V1)-(R2/R1)*V2\n",
+ "Vo4 = ((1+(R2/R1)+(0))*V1)-(R2/R1)*V2 #by substituting R3 = infinity in above equation abo\n",
+ "#Result\n",
+ "print(\"output voltage case-1:\")\n",
+ "print(\"Vo1 = %.2f V\\n\"%Vo1)\n",
+ "print(\"output voltage case-2:\")\n",
+ "print(\"Vo2 = %.2f V\\n\"%Vo2)\n",
+ "print(\"output voltage case-3:\")\n",
+ "print(\"Vo3 = %.2f V\\n\"%Vo3)\n",
+ "print(\"output voltage case-4:\")\n",
+ "print(\"Vo3 = %.2f V\"%Vo4)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output voltage case-1:\n",
+ "Vo1 = 2.00 V\n",
+ "\n",
+ "output voltage case-2:\n",
+ "Vo2 = 1.10 V\n",
+ "\n",
+ "output voltage case-3:\n",
+ "Vo3 = 1.01 V\n",
+ "\n",
+ "output voltage case-4:\n",
+ "Vo3 = 1.00 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_9,pg 486"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# difference in output voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#(R3/R1)=0.98^-1(R2/R4)\n",
+ "R1=10.0*10**3 # Resistor R1\n",
+ "R3=10.0*10**3 # Resistor R3\n",
+ "I1=130.0*10**-6 # Current \n",
+ "\n",
+ "#Calculations\n",
+ "Vo1=R1*(1+0.98)*I1 #output for case-1, (R2/R4)=0.98\n",
+ "#(R1/R3)=(R4/R2)\n",
+ "Vo2=R1*(1+(R3/R1))*I1 #output for case-2\n",
+ "Vo12=((Vo2-Vo1)/Vo2)*100 #percent difference\n",
+ "\n",
+ "#Result\n",
+ "print(\"difference in output voltage:\")\n",
+ "print(\"%% difference = %.1f %%\"%Vo12)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "difference in output voltage:\n",
+ "% difference = 1.0 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_10,pg 486"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find crest factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "dutcyc=0.4 #duty cycle\n",
+ "\n",
+ "#Calculations\n",
+ "CF=math.sqrt((1-dutcyc)/dutcyc) #crest factor\n",
+ "\n",
+ "#Result\n",
+ "print(\"crest factor:\")\n",
+ "print(\"CF = %.3f \"%(math.floor(CF*1000)/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "crest factor:\n",
+ "CF = 1.224 \n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_11,pg 486"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Find unknown resisance\n",
+ "\n",
+ "import math\n",
+ "R1=10*10**3 #resistor R1\n",
+ "R4=10*10**3 #resistor R4\n",
+ "Idss=1*10**-3 #drain saturation current\n",
+ "Vp=2.2 #peak voltage\n",
+ "Vo=10.0 #output voltage\n",
+ "V2=2.0 #input-1\n",
+ "V1=-2.0 #input-2\n",
+ "\n",
+ "#Calculations\n",
+ "R5=((R1*R4)/Vo)*((-2*Idss/(Vp**2)))*V1*V2\n",
+ "\n",
+ "#Result\n",
+ "print(\"R5 = %.1f k-ohm\"%(R5/1000))\n",
+ "#R5 should satisfy the condition R5=((1+R1*(-2*Idss*Vp)/R2)*R3*R6) and with Vp negative it is obiviously possible"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "R5 = 16.5 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch2_1.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch2_1.ipynb new file mode 100755 index 00000000..26ecb8a9 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch2_1.ipynb @@ -0,0 +1,547 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 2: Measurement Of Electrical Quantities"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_1,pg 23"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# output voltage \n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "ic=1*10**-3 #constant current source\n",
+ "Rf=15*10**3 #feedback resistance\n",
+ "Rs=10*10**3 #input resistance\n",
+ "Rx=1.0*10**3 #unknown resistance\n",
+ "R1=10.0 #unknown resistance\n",
+ "R2=1*10**3 #input resistance\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "# for fig. 2.7\n",
+ "Vo1=ic*Rf*(Rx/(1+(Rx*Rs))) #output voltage case-1\n",
+ "#for fig. 2.8\n",
+ "Vo2=ic*Rx*(R1/(1+R1*R2)) #output voltage case-2\n",
+ "\n",
+ "#Result\n",
+ "print(\"output voltage for case-1:\")\n",
+ "print(\"Vo1 = %.4f V\\n\"%Vo1)\n",
+ "print(\"output voltage for case-2:\")\n",
+ "print(\"Vo2 = %.0f mV\\n\"%(Vo2*10**3))\n",
+ "#Answer for case-1 is different in the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output voltage for case-1:\n",
+ "Vo1 = 0.0015 V\n",
+ "\n",
+ "output voltage for case-2:\n",
+ "Vo2 = 1 mV\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_2,pg 27"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find Ad CMRR and Acm\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "V1=5.0 #input-1\n",
+ "V2=5.0 #input-2\n",
+ "V12=50*10**-3 #difference input\n",
+ "Vo=2.0 #output voltage\n",
+ "acc=0.01 #accuracy\n",
+ "\n",
+ "#Calculations\n",
+ "Ad=(Vo/V12) #diffrential gain\n",
+ "#error at the output should be less than (2/100)V or 20mV.if common mode gain is the only source of error then \n",
+ "err=Vo*acc #error\n",
+ "Acm=(err/V1) #common mode gain\n",
+ "CMRR=20*math.log10(Ad/Acm) #common mode rejection ratio in dB\n",
+ "\n",
+ "#Result\n",
+ "print(\"diffrential gain:\")\n",
+ "print(\"Ad=%.1f \\n\"%Ad)\n",
+ "print(\"common mode gain:\")\n",
+ "print(\"Acm=%.4f \"%Acm)\n",
+ "print(\"\\nCMRR=%.1f dB\\n\"%CMRR)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "diffrential gain:\n",
+ "Ad=40.0 \n",
+ "\n",
+ "common mode gain:\n",
+ "Acm=0.0040 \n",
+ "\n",
+ "CMRR=80.0 dB\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_3,pg 484"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find full scale output and minimum input\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Aol=1.0*10**5 #open loop gain\n",
+ "R2=10.0*10**3 #Resistor R2\n",
+ "R3=10.0*10**3 #Resistor R3\n",
+ "R1=100*10**3 #input resistance\n",
+ "Vac=24.0 #maximum input\n",
+ "\n",
+ "#Calculations\n",
+ "Vo=(R2/R1)*Vac #output full scale\n",
+ "Vth=0.6 #threshold voltage\n",
+ "Vn=(Vth/Aol) #minimum input\n",
+ "\n",
+ "#Result\n",
+ "print(\"output FS voltage:\")\n",
+ "print(\"Vo = %.2f V\\n\"%Vo)\n",
+ "print(\"minimum input voltage:\")\n",
+ "print(\"Vn = %.1f micro-V\\n\"%(Vn*10**6))\n",
+ "#Answer for Vn is wrong in the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output FS voltage:\n",
+ "Vo = 2.40 V\n",
+ "\n",
+ "minimum input voltage:\n",
+ "Vn = 6.0 micro-V\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_4,pg 484"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# output voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vp=1.0 #peak input voltage\n",
+ "f=50.0 #frequency\n",
+ "#R1=R2\n",
+ "\n",
+ "#Calculations\n",
+ "#since halfwave rectification is done,integration gives the value\n",
+ "pi =math.floor(math.pi*100)/100\n",
+ "Vo=0.5*((2*Vp)/pi) #output voltage,pi=3.14 \n",
+ "\n",
+ "#Result\n",
+ "print(\"output voltage:\")\n",
+ "print(\"Vo = %.3f V\\n\"%Vo)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output voltage:\n",
+ "Vo = 0.318 V\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_5,pg 484"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find unknown resistance\n",
+ "\n",
+ "import math\n",
+ "#VBariable declaration\n",
+ "ic=0.1*10**-3 #constant current source\n",
+ "Vo=2.0 #output voltage\n",
+ "Rf=22.0*10**3 #feedback resistance\n",
+ "Rs=10.0*10**3 #input resistance\n",
+ "\n",
+ "#Calculations\n",
+ "Rx=(1/(((ic*Rf)/(Vo*Rs))-(1/Rs)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"unknown resistance:\")\n",
+ "print(\"Rx = %.0f k-ohm\\n\"%(Rx/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "unknown resistance:\n",
+ "Rx = 100 k-ohm\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_6,pg 484"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find CMRR\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "a=0.9 #parameter of diff. amplr.\n",
+ "b=1.1 #parameter of diff. amplr.\n",
+ "\n",
+ "#Calculations\n",
+ "CMRR=0.5*(((1+a)*b+(1+b)*a))/((1+a)*b-(1+b)*a)\n",
+ "\n",
+ "#Results\n",
+ "print(\"CMRR = %.2f\"%CMRR)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "CMRR = 9.95\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_7,pg 485"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# tolerance in parameters\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "CMRR=10.0*10**4 #common mode rejection ratio\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "#set a=beta+k1*delbeta and b=beta(-/+)k2*delbeta\n",
+ "#CMRR=0.5*((4(+/-)3*delbeta*(k1-k2))/((+/-)delbeta*(k1-k2)))\n",
+ "#CMRR=0.5*((4(+/-)3*(a1-a2))/((+/-)(a1-a2)))\n",
+ "#a1->k1*delbeta, a2->k2*delbeta\n",
+ "\n",
+ "delalpha=(2/CMRR) #a1-a2=delalpha\n",
+ "\n",
+ "#Result\n",
+ "print(\"tolerance in parameters:\")\n",
+ "print(\"delalpha = %.0f * 10^-5 \"%(delalpha*10**5))\n",
+ "print(\"Therefore, if a varies by 1 percent, b should not vary more than 2*10^-3 percent of variation of a.\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "tolerance in parameters:\n",
+ "delalpha = 2 * 10^-5 \n",
+ "Therefore, if a varies by 1 percent, b should not vary more than 2*10^-3 percent of variation of a.\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_8,pg 485"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# output voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R1=10*10**3 #resistor R1\n",
+ "R2=10*10**3 #resistor R2\n",
+ "V1=1.0 #input voltage-1\n",
+ "V2=1.0 #input voltage-2\n",
+ "R31=10.0*10**3 #Resistor R3,case-1\n",
+ "R32=100.0*10**3 #Resistor R3,case-2\n",
+ "R33=1000.0*10**3 #Resistor R3,case-3\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "Vo1=((1+(R2/R1)+(R2/R31))*V1)-(R2/R1)*V2\n",
+ "Vo2=((1+(R2/R1)+(R2/R32))*V1)-(R2/R1)*V2\n",
+ "Vo3=((1+(R2/R1)+(R2/R33))*V1)-(R2/R1)*V2\n",
+ "Vo4 = ((1+(R2/R1)+(0))*V1)-(R2/R1)*V2 #by substituting R3 = infinity in above equation abo\n",
+ "#Result\n",
+ "print(\"output voltage case-1:\")\n",
+ "print(\"Vo1 = %.2f V\\n\"%Vo1)\n",
+ "print(\"output voltage case-2:\")\n",
+ "print(\"Vo2 = %.2f V\\n\"%Vo2)\n",
+ "print(\"output voltage case-3:\")\n",
+ "print(\"Vo3 = %.2f V\\n\"%Vo3)\n",
+ "print(\"output voltage case-4:\")\n",
+ "print(\"Vo3 = %.2f V\"%Vo4)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output voltage case-1:\n",
+ "Vo1 = 2.00 V\n",
+ "\n",
+ "output voltage case-2:\n",
+ "Vo2 = 1.10 V\n",
+ "\n",
+ "output voltage case-3:\n",
+ "Vo3 = 1.01 V\n",
+ "\n",
+ "output voltage case-4:\n",
+ "Vo3 = 1.00 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_9,pg 486"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# difference in output voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#(R3/R1)=0.98^-1(R2/R4)\n",
+ "R1=10.0*10**3 # Resistor R1\n",
+ "R3=10.0*10**3 # Resistor R3\n",
+ "I1=130.0*10**-6 # Current \n",
+ "\n",
+ "#Calculations\n",
+ "Vo1=R1*(1+0.98)*I1 #output for case-1, (R2/R4)=0.98\n",
+ "#(R1/R3)=(R4/R2)\n",
+ "Vo2=R1*(1+(R3/R1))*I1 #output for case-2\n",
+ "Vo12=((Vo2-Vo1)/Vo2)*100 #percent difference\n",
+ "\n",
+ "#Result\n",
+ "print(\"difference in output voltage:\")\n",
+ "print(\"%% difference = %.1f %%\"%Vo12)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "difference in output voltage:\n",
+ "% difference = 1.0 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_10,pg 486"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find crest factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "dutcyc=0.4 #duty cycle\n",
+ "\n",
+ "#Calculations\n",
+ "CF=math.sqrt((1-dutcyc)/dutcyc) #crest factor\n",
+ "\n",
+ "#Result\n",
+ "print(\"crest factor:\")\n",
+ "print(\"CF = %.3f \"%(math.floor(CF*1000)/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "crest factor:\n",
+ "CF = 1.224 \n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_11,pg 486"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Find unknown resisance\n",
+ "\n",
+ "import math\n",
+ "R1=10*10**3 #resistor R1\n",
+ "R4=10*10**3 #resistor R4\n",
+ "Idss=1*10**-3 #drain saturation current\n",
+ "Vp=2.2 #peak voltage\n",
+ "Vo=10.0 #output voltage\n",
+ "V2=2.0 #input-1\n",
+ "V1=-2.0 #input-2\n",
+ "\n",
+ "#Calculations\n",
+ "R5=((R1*R4)/Vo)*((-2*Idss/(Vp**2)))*V1*V2\n",
+ "\n",
+ "#Result\n",
+ "print(\"R5 = %.1f k-ohm\"%(R5/1000))\n",
+ "#R5 should satisfy the condition R5=((1+R1*(-2*Idss*Vp)/R2)*R3*R6) and with Vp negative it is obiviously possible"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "R5 = 16.5 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch2_2.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch2_2.ipynb new file mode 100755 index 00000000..26ecb8a9 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch2_2.ipynb @@ -0,0 +1,547 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 2: Measurement Of Electrical Quantities"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_1,pg 23"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# output voltage \n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "ic=1*10**-3 #constant current source\n",
+ "Rf=15*10**3 #feedback resistance\n",
+ "Rs=10*10**3 #input resistance\n",
+ "Rx=1.0*10**3 #unknown resistance\n",
+ "R1=10.0 #unknown resistance\n",
+ "R2=1*10**3 #input resistance\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "# for fig. 2.7\n",
+ "Vo1=ic*Rf*(Rx/(1+(Rx*Rs))) #output voltage case-1\n",
+ "#for fig. 2.8\n",
+ "Vo2=ic*Rx*(R1/(1+R1*R2)) #output voltage case-2\n",
+ "\n",
+ "#Result\n",
+ "print(\"output voltage for case-1:\")\n",
+ "print(\"Vo1 = %.4f V\\n\"%Vo1)\n",
+ "print(\"output voltage for case-2:\")\n",
+ "print(\"Vo2 = %.0f mV\\n\"%(Vo2*10**3))\n",
+ "#Answer for case-1 is different in the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output voltage for case-1:\n",
+ "Vo1 = 0.0015 V\n",
+ "\n",
+ "output voltage for case-2:\n",
+ "Vo2 = 1 mV\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_2,pg 27"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find Ad CMRR and Acm\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "V1=5.0 #input-1\n",
+ "V2=5.0 #input-2\n",
+ "V12=50*10**-3 #difference input\n",
+ "Vo=2.0 #output voltage\n",
+ "acc=0.01 #accuracy\n",
+ "\n",
+ "#Calculations\n",
+ "Ad=(Vo/V12) #diffrential gain\n",
+ "#error at the output should be less than (2/100)V or 20mV.if common mode gain is the only source of error then \n",
+ "err=Vo*acc #error\n",
+ "Acm=(err/V1) #common mode gain\n",
+ "CMRR=20*math.log10(Ad/Acm) #common mode rejection ratio in dB\n",
+ "\n",
+ "#Result\n",
+ "print(\"diffrential gain:\")\n",
+ "print(\"Ad=%.1f \\n\"%Ad)\n",
+ "print(\"common mode gain:\")\n",
+ "print(\"Acm=%.4f \"%Acm)\n",
+ "print(\"\\nCMRR=%.1f dB\\n\"%CMRR)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "diffrential gain:\n",
+ "Ad=40.0 \n",
+ "\n",
+ "common mode gain:\n",
+ "Acm=0.0040 \n",
+ "\n",
+ "CMRR=80.0 dB\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_3,pg 484"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find full scale output and minimum input\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Aol=1.0*10**5 #open loop gain\n",
+ "R2=10.0*10**3 #Resistor R2\n",
+ "R3=10.0*10**3 #Resistor R3\n",
+ "R1=100*10**3 #input resistance\n",
+ "Vac=24.0 #maximum input\n",
+ "\n",
+ "#Calculations\n",
+ "Vo=(R2/R1)*Vac #output full scale\n",
+ "Vth=0.6 #threshold voltage\n",
+ "Vn=(Vth/Aol) #minimum input\n",
+ "\n",
+ "#Result\n",
+ "print(\"output FS voltage:\")\n",
+ "print(\"Vo = %.2f V\\n\"%Vo)\n",
+ "print(\"minimum input voltage:\")\n",
+ "print(\"Vn = %.1f micro-V\\n\"%(Vn*10**6))\n",
+ "#Answer for Vn is wrong in the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output FS voltage:\n",
+ "Vo = 2.40 V\n",
+ "\n",
+ "minimum input voltage:\n",
+ "Vn = 6.0 micro-V\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_4,pg 484"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# output voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vp=1.0 #peak input voltage\n",
+ "f=50.0 #frequency\n",
+ "#R1=R2\n",
+ "\n",
+ "#Calculations\n",
+ "#since halfwave rectification is done,integration gives the value\n",
+ "pi =math.floor(math.pi*100)/100\n",
+ "Vo=0.5*((2*Vp)/pi) #output voltage,pi=3.14 \n",
+ "\n",
+ "#Result\n",
+ "print(\"output voltage:\")\n",
+ "print(\"Vo = %.3f V\\n\"%Vo)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output voltage:\n",
+ "Vo = 0.318 V\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_5,pg 484"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find unknown resistance\n",
+ "\n",
+ "import math\n",
+ "#VBariable declaration\n",
+ "ic=0.1*10**-3 #constant current source\n",
+ "Vo=2.0 #output voltage\n",
+ "Rf=22.0*10**3 #feedback resistance\n",
+ "Rs=10.0*10**3 #input resistance\n",
+ "\n",
+ "#Calculations\n",
+ "Rx=(1/(((ic*Rf)/(Vo*Rs))-(1/Rs)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"unknown resistance:\")\n",
+ "print(\"Rx = %.0f k-ohm\\n\"%(Rx/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "unknown resistance:\n",
+ "Rx = 100 k-ohm\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_6,pg 484"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find CMRR\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "a=0.9 #parameter of diff. amplr.\n",
+ "b=1.1 #parameter of diff. amplr.\n",
+ "\n",
+ "#Calculations\n",
+ "CMRR=0.5*(((1+a)*b+(1+b)*a))/((1+a)*b-(1+b)*a)\n",
+ "\n",
+ "#Results\n",
+ "print(\"CMRR = %.2f\"%CMRR)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "CMRR = 9.95\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_7,pg 485"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# tolerance in parameters\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "CMRR=10.0*10**4 #common mode rejection ratio\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "#set a=beta+k1*delbeta and b=beta(-/+)k2*delbeta\n",
+ "#CMRR=0.5*((4(+/-)3*delbeta*(k1-k2))/((+/-)delbeta*(k1-k2)))\n",
+ "#CMRR=0.5*((4(+/-)3*(a1-a2))/((+/-)(a1-a2)))\n",
+ "#a1->k1*delbeta, a2->k2*delbeta\n",
+ "\n",
+ "delalpha=(2/CMRR) #a1-a2=delalpha\n",
+ "\n",
+ "#Result\n",
+ "print(\"tolerance in parameters:\")\n",
+ "print(\"delalpha = %.0f * 10^-5 \"%(delalpha*10**5))\n",
+ "print(\"Therefore, if a varies by 1 percent, b should not vary more than 2*10^-3 percent of variation of a.\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "tolerance in parameters:\n",
+ "delalpha = 2 * 10^-5 \n",
+ "Therefore, if a varies by 1 percent, b should not vary more than 2*10^-3 percent of variation of a.\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_8,pg 485"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# output voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R1=10*10**3 #resistor R1\n",
+ "R2=10*10**3 #resistor R2\n",
+ "V1=1.0 #input voltage-1\n",
+ "V2=1.0 #input voltage-2\n",
+ "R31=10.0*10**3 #Resistor R3,case-1\n",
+ "R32=100.0*10**3 #Resistor R3,case-2\n",
+ "R33=1000.0*10**3 #Resistor R3,case-3\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "Vo1=((1+(R2/R1)+(R2/R31))*V1)-(R2/R1)*V2\n",
+ "Vo2=((1+(R2/R1)+(R2/R32))*V1)-(R2/R1)*V2\n",
+ "Vo3=((1+(R2/R1)+(R2/R33))*V1)-(R2/R1)*V2\n",
+ "Vo4 = ((1+(R2/R1)+(0))*V1)-(R2/R1)*V2 #by substituting R3 = infinity in above equation abo\n",
+ "#Result\n",
+ "print(\"output voltage case-1:\")\n",
+ "print(\"Vo1 = %.2f V\\n\"%Vo1)\n",
+ "print(\"output voltage case-2:\")\n",
+ "print(\"Vo2 = %.2f V\\n\"%Vo2)\n",
+ "print(\"output voltage case-3:\")\n",
+ "print(\"Vo3 = %.2f V\\n\"%Vo3)\n",
+ "print(\"output voltage case-4:\")\n",
+ "print(\"Vo3 = %.2f V\"%Vo4)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output voltage case-1:\n",
+ "Vo1 = 2.00 V\n",
+ "\n",
+ "output voltage case-2:\n",
+ "Vo2 = 1.10 V\n",
+ "\n",
+ "output voltage case-3:\n",
+ "Vo3 = 1.01 V\n",
+ "\n",
+ "output voltage case-4:\n",
+ "Vo3 = 1.00 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_9,pg 486"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# difference in output voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#(R3/R1)=0.98^-1(R2/R4)\n",
+ "R1=10.0*10**3 # Resistor R1\n",
+ "R3=10.0*10**3 # Resistor R3\n",
+ "I1=130.0*10**-6 # Current \n",
+ "\n",
+ "#Calculations\n",
+ "Vo1=R1*(1+0.98)*I1 #output for case-1, (R2/R4)=0.98\n",
+ "#(R1/R3)=(R4/R2)\n",
+ "Vo2=R1*(1+(R3/R1))*I1 #output for case-2\n",
+ "Vo12=((Vo2-Vo1)/Vo2)*100 #percent difference\n",
+ "\n",
+ "#Result\n",
+ "print(\"difference in output voltage:\")\n",
+ "print(\"%% difference = %.1f %%\"%Vo12)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "difference in output voltage:\n",
+ "% difference = 1.0 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_10,pg 486"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find crest factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "dutcyc=0.4 #duty cycle\n",
+ "\n",
+ "#Calculations\n",
+ "CF=math.sqrt((1-dutcyc)/dutcyc) #crest factor\n",
+ "\n",
+ "#Result\n",
+ "print(\"crest factor:\")\n",
+ "print(\"CF = %.3f \"%(math.floor(CF*1000)/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "crest factor:\n",
+ "CF = 1.224 \n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2_11,pg 486"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Find unknown resisance\n",
+ "\n",
+ "import math\n",
+ "R1=10*10**3 #resistor R1\n",
+ "R4=10*10**3 #resistor R4\n",
+ "Idss=1*10**-3 #drain saturation current\n",
+ "Vp=2.2 #peak voltage\n",
+ "Vo=10.0 #output voltage\n",
+ "V2=2.0 #input-1\n",
+ "V1=-2.0 #input-2\n",
+ "\n",
+ "#Calculations\n",
+ "R5=((R1*R4)/Vo)*((-2*Idss/(Vp**2)))*V1*V2\n",
+ "\n",
+ "#Result\n",
+ "print(\"R5 = %.1f k-ohm\"%(R5/1000))\n",
+ "#R5 should satisfy the condition R5=((1+R1*(-2*Idss*Vp)/R2)*R3*R6) and with Vp negative it is obiviously possible"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "R5 = 16.5 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch3.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch3.ipynb new file mode 100755 index 00000000..3eb1f316 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch3.ipynb @@ -0,0 +1,283 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 3: Digital Elements and Features"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3_1,pg 487"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# equivalence comparator\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "in1 = 1 # input-1\n",
+ "in2 = not(in1) # input-2\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "out=((not(in1))*( not(in2)))+(in1*in2)\n",
+ "\n",
+ "#Result\n",
+ "print(\"output of comparator:\")\n",
+ "print(\"out = %d\"% out)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output of comparator:\n",
+ "out = 0\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3_2,pg 487"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# antivalence comparator\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "in1 = 1 # input-1\n",
+ "in2 = not(in1) # input-2\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "out=((not(in1))+( not(in2)))*(in1+in2)\n",
+ "\n",
+ "#Result\n",
+ "print(\"output of comparator:\")\n",
+ "print(\"out = %d\"%out)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output of comparator:\n",
+ "out = 1\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3_3,pg 487"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "print(\"Theoretical example\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Theoretical example\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3_4,pg 487"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "print(\"Theoretical example\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Theoretical example\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3_5,pg 488"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# simplify Boolean function\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration(Inputs)\n",
+ "#enter binary values only(1bit)\n",
+ "a=input(\"enter value of a\") #input-1\n",
+ "b=input(\"enter value of b\") #input-2\n",
+ "c=input(\"enter value of c\") #input-3\n",
+ " \n",
+ "#Calculations\n",
+ "x=not(a and b)\n",
+ "y=(x or c) #final output\n",
+ "\n",
+ "#Result\n",
+ "print(\"\\noutput:y=%d\\n\"%y)\n",
+ "print(\"verify from truth table\\n\")\n",
+ "print(\"a b c y\\n\")\n",
+ "print(\"0 0 0 1\\n\")\n",
+ "print(\"0 0 1 1\\n\")\n",
+ "print(\"0 1 0 1\\n\")\n",
+ "print(\"0 1 1 1\\n\")\n",
+ "print(\"1 0 0 1\\n\")\n",
+ "print(\"1 0 1 1\\n\")\n",
+ "print(\"1 1 0 0\\n\")\n",
+ "print(\"1 1 1 1\\n\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "enter value of a1\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "enter value of b1\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "enter value of c0\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "output:y=0\n",
+ "\n",
+ "verify from truth table\n",
+ "\n",
+ "a b c y\n",
+ "\n",
+ "0 0 0 1\n",
+ "\n",
+ "0 0 1 1\n",
+ "\n",
+ "0 1 0 1\n",
+ "\n",
+ "0 1 1 1\n",
+ "\n",
+ "1 0 0 1\n",
+ "\n",
+ "1 0 1 1\n",
+ "\n",
+ "1 1 0 0\n",
+ "\n",
+ "1 1 1 1\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3_6,pg 488"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "print(\"Theoretical example\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Theoretical example\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch3_1.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch3_1.ipynb new file mode 100755 index 00000000..3eb1f316 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch3_1.ipynb @@ -0,0 +1,283 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 3: Digital Elements and Features"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3_1,pg 487"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# equivalence comparator\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "in1 = 1 # input-1\n",
+ "in2 = not(in1) # input-2\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "out=((not(in1))*( not(in2)))+(in1*in2)\n",
+ "\n",
+ "#Result\n",
+ "print(\"output of comparator:\")\n",
+ "print(\"out = %d\"% out)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output of comparator:\n",
+ "out = 0\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3_2,pg 487"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# antivalence comparator\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "in1 = 1 # input-1\n",
+ "in2 = not(in1) # input-2\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "out=((not(in1))+( not(in2)))*(in1+in2)\n",
+ "\n",
+ "#Result\n",
+ "print(\"output of comparator:\")\n",
+ "print(\"out = %d\"%out)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output of comparator:\n",
+ "out = 1\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3_3,pg 487"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "print(\"Theoretical example\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Theoretical example\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3_4,pg 487"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "print(\"Theoretical example\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Theoretical example\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3_5,pg 488"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# simplify Boolean function\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration(Inputs)\n",
+ "#enter binary values only(1bit)\n",
+ "a=input(\"enter value of a\") #input-1\n",
+ "b=input(\"enter value of b\") #input-2\n",
+ "c=input(\"enter value of c\") #input-3\n",
+ " \n",
+ "#Calculations\n",
+ "x=not(a and b)\n",
+ "y=(x or c) #final output\n",
+ "\n",
+ "#Result\n",
+ "print(\"\\noutput:y=%d\\n\"%y)\n",
+ "print(\"verify from truth table\\n\")\n",
+ "print(\"a b c y\\n\")\n",
+ "print(\"0 0 0 1\\n\")\n",
+ "print(\"0 0 1 1\\n\")\n",
+ "print(\"0 1 0 1\\n\")\n",
+ "print(\"0 1 1 1\\n\")\n",
+ "print(\"1 0 0 1\\n\")\n",
+ "print(\"1 0 1 1\\n\")\n",
+ "print(\"1 1 0 0\\n\")\n",
+ "print(\"1 1 1 1\\n\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "enter value of a1\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "enter value of b1\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "enter value of c0\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "output:y=0\n",
+ "\n",
+ "verify from truth table\n",
+ "\n",
+ "a b c y\n",
+ "\n",
+ "0 0 0 1\n",
+ "\n",
+ "0 0 1 1\n",
+ "\n",
+ "0 1 0 1\n",
+ "\n",
+ "0 1 1 1\n",
+ "\n",
+ "1 0 0 1\n",
+ "\n",
+ "1 0 1 1\n",
+ "\n",
+ "1 1 0 0\n",
+ "\n",
+ "1 1 1 1\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3_6,pg 488"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "print(\"Theoretical example\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Theoretical example\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch3_2.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch3_2.ipynb new file mode 100755 index 00000000..3eb1f316 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch3_2.ipynb @@ -0,0 +1,283 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 3: Digital Elements and Features"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3_1,pg 487"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# equivalence comparator\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "in1 = 1 # input-1\n",
+ "in2 = not(in1) # input-2\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "out=((not(in1))*( not(in2)))+(in1*in2)\n",
+ "\n",
+ "#Result\n",
+ "print(\"output of comparator:\")\n",
+ "print(\"out = %d\"% out)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output of comparator:\n",
+ "out = 0\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3_2,pg 487"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# antivalence comparator\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "in1 = 1 # input-1\n",
+ "in2 = not(in1) # input-2\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "out=((not(in1))+( not(in2)))*(in1+in2)\n",
+ "\n",
+ "#Result\n",
+ "print(\"output of comparator:\")\n",
+ "print(\"out = %d\"%out)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output of comparator:\n",
+ "out = 1\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3_3,pg 487"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "print(\"Theoretical example\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Theoretical example\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3_4,pg 487"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "print(\"Theoretical example\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Theoretical example\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3_5,pg 488"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# simplify Boolean function\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration(Inputs)\n",
+ "#enter binary values only(1bit)\n",
+ "a=input(\"enter value of a\") #input-1\n",
+ "b=input(\"enter value of b\") #input-2\n",
+ "c=input(\"enter value of c\") #input-3\n",
+ " \n",
+ "#Calculations\n",
+ "x=not(a and b)\n",
+ "y=(x or c) #final output\n",
+ "\n",
+ "#Result\n",
+ "print(\"\\noutput:y=%d\\n\"%y)\n",
+ "print(\"verify from truth table\\n\")\n",
+ "print(\"a b c y\\n\")\n",
+ "print(\"0 0 0 1\\n\")\n",
+ "print(\"0 0 1 1\\n\")\n",
+ "print(\"0 1 0 1\\n\")\n",
+ "print(\"0 1 1 1\\n\")\n",
+ "print(\"1 0 0 1\\n\")\n",
+ "print(\"1 0 1 1\\n\")\n",
+ "print(\"1 1 0 0\\n\")\n",
+ "print(\"1 1 1 1\\n\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "enter value of a1\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "enter value of b1\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "enter value of c0\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "output:y=0\n",
+ "\n",
+ "verify from truth table\n",
+ "\n",
+ "a b c y\n",
+ "\n",
+ "0 0 0 1\n",
+ "\n",
+ "0 0 1 1\n",
+ "\n",
+ "0 1 0 1\n",
+ "\n",
+ "0 1 1 1\n",
+ "\n",
+ "1 0 0 1\n",
+ "\n",
+ "1 0 1 1\n",
+ "\n",
+ "1 1 0 0\n",
+ "\n",
+ "1 1 1 1\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3_6,pg 488"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "print(\"Theoretical example\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Theoretical example\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch4.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch4.ipynb new file mode 100755 index 00000000..c07461ef --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch4.ipynb @@ -0,0 +1,635 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 4 : Combinational And Sequential Logic Circuits"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_1,pg 488"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find output and carry\n",
+ "# it is a half-adder circuit with the output 'a' and carry 'c' given by the boolean equations\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "b1 = 1 #input-1\n",
+ "b2 = 1 #input-2\n",
+ "\n",
+ "#Calculations\n",
+ "a=(b1 and (not b2))+((not b1) and b2) #sum\n",
+ "c=(b1 and b2) #carry\n",
+ "\n",
+ "#Result\n",
+ "print(\"sum:\")\n",
+ "print(\"a = %d\\n\"%a)\n",
+ "print(\"carry:\")\n",
+ "print(\"c = %.f\"%c) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "sum:\n",
+ "a = 0\n",
+ "\n",
+ "carry:\n",
+ "c = 1\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_2,pg 489"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find difference and borrow\n",
+ "#the circuit is that of a half subtractor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "b1 = 1 #input-1, case-1\n",
+ "B1 = 0 #input-2 case-1\n",
+ "b2 = 1 #input-1, case 2\n",
+ "B2 = 1 #input-2, case 2\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "#case-1\n",
+ "d1=(b1 and (not B1))+(B1 and (not b1)) #difference\n",
+ "r1=(b1 and (not B1)) #borrow\n",
+ "\n",
+ "#case-2\n",
+ "d2=(b2 and (not B2))+(B2 and (not b2))\n",
+ "r2=(b2 and (not B2))\n",
+ "\n",
+ "#Result\n",
+ "print(\"difference case-1:\")\n",
+ "print(\"d1 = %d\"%d1)\n",
+ "print(\"borrow case-1:\")\n",
+ "print(\"r1 = %.f\\n\"%r1)\n",
+ "print(\"difference case-2:\")\n",
+ "print(\"d2 = %.f\"%d2)\n",
+ "print(\"borrow case-2:\")\n",
+ "print(\"r2 = %.f\\n\"%r2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "difference case-1:\n",
+ "d1 = 1\n",
+ "borrow case-1:\n",
+ "r1 = 1\n",
+ "\n",
+ "difference case-2:\n",
+ "d2 = 0\n",
+ "borrow case-2:\n",
+ "r2 = 0\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_3,pg 489"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find final output\n",
+ "\n",
+ "import math \n",
+ "#Variable declaration\n",
+ "b=1 #input-1\n",
+ "B=0 #input-2\n",
+ "\n",
+ "#Calculations\n",
+ "y=(not((b or B)) or (b and B))\n",
+ "\n",
+ "#Result\n",
+ "print(\"final output:\")\n",
+ "print(\"y = %d\"%y)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "final output:\n",
+ "y = 0\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_4_a,pg 489"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# decoder output\n",
+ "\n",
+ "import math\n",
+ "#VAriable declaration\n",
+ "#initial conditions\n",
+ "b = 0 # input \n",
+ "Bi = 0 # initial value\n",
+ "Bf = 1 # final value\n",
+ "\n",
+ "#initial state of outputs\n",
+ "\n",
+ "y1i=not(b or Bi)\n",
+ "\n",
+ "y2i=not(b or (not Bi))\n",
+ "\n",
+ "y3i=not(Bi or (not(b)))\n",
+ "\n",
+ "y4i=not((not(Bi)) or (not(b)))\n",
+ "\n",
+ "#final state of outputs\n",
+ "\n",
+ "y1f=not(b or Bf)\n",
+ "\n",
+ "y2f=not(Bf or (not(b)))\n",
+ "\n",
+ "y3f=not(b or (not(Bf)))\n",
+ "\n",
+ "y4f=not((not(Bf)) or (not(b)))\n",
+ "\n",
+ "print(\"first: \")\n",
+ "print(\"y1 = %.f \"%y1i)\n",
+ "print(\"y2 = %.f \"%y2i)\n",
+ "print(\"y3 = %.f \"%y3i)\n",
+ "print(\"y4 = %.f\\n\"%y4i)\n",
+ "print(\"next: \")\n",
+ "print(\"y1 = %.f \"%y1f)\n",
+ "print(\"y2 = %.f \"%y2f)\n",
+ "print(\"y3 = %.f \"%y3f)\n",
+ "print(\"y4 = %.f\"%y4f)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "first: \n",
+ "y1 = 1 \n",
+ "y2 = 0 \n",
+ "y3 = 0 \n",
+ "y4 = 0\n",
+ "\n",
+ "next: \n",
+ "y1 = 0 \n",
+ "y2 = 0 \n",
+ "y3 = 1 \n",
+ "y4 = 0\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_4_b,pg 489"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# decoder output\n",
+ "\n",
+ "import math\n",
+ "#VAriable declaration\n",
+ "#initial conditions\n",
+ "b = 1 # input \n",
+ "Bi = 0 # initial value\n",
+ "Bf = 1 # final value\n",
+ "\n",
+ "#initial state of outputs\n",
+ "\n",
+ "y1i=not(b or Bi)\n",
+ "\n",
+ "y2i=not(Bi or (not(b)))\n",
+ "\n",
+ "y3i=not(b or (not Bi))\n",
+ "\n",
+ "y4i=not((not(Bi)) or (not(b)))\n",
+ "\n",
+ "#final state of outputs\n",
+ "\n",
+ "y1f=not(b or Bf)\n",
+ "\n",
+ "y2f=not(b or (not(Bf)))\n",
+ "\n",
+ "y3f=not(Bf or (not(b)))\n",
+ "\n",
+ "y4f=not((not(Bf)) or (not(b)))\n",
+ "\n",
+ "print(\"first: \")\n",
+ "print(\"y1=%.f \"%y1i)\n",
+ "print(\"y2=%.f \"%y2i)\n",
+ "print(\"y3=%.f \"%y3i)\n",
+ "print(\"y4=%.f\\n\"%y4i)\n",
+ "print(\"next: \")\n",
+ "print(\"y1=%.f \"%y1f)\n",
+ "print(\"y2=%.f \"%y2f)\n",
+ "print(\"y3=%.f \"%y3f)\n",
+ "print(\"y4=%.f\"%y4f)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "first: \n",
+ "y1=0 \n",
+ "y2=1 \n",
+ "y3=0 \n",
+ "y4=0\n",
+ "\n",
+ "next: \n",
+ "y1=0 \n",
+ "y2=0 \n",
+ "y3=0 \n",
+ "y4=1\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_5,pg 489"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# convert 8421 to 2421 code\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#if A8,B8,C8,D8 is the binary in 8421 code, for 12 this would be 1100(DCBA)\n",
+ "#in 8421-code\n",
+ "A8 = 0\n",
+ "B8 = 0\n",
+ "C8 = 1\n",
+ "D8 = 1\n",
+ "\n",
+ "#Calculations\n",
+ "#in 2421-code\n",
+ "D2 = D8\n",
+ "C2 =(C8 or D8)\n",
+ "B2 =(B8 or D8)\n",
+ "A2=A8\n",
+ "\n",
+ "#Result\n",
+ "print(\"2421-code for 12(1100) is:\")\n",
+ "print(\"%d%d%d%d \"%(D2,C2,B2,A2))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2421-code for 12(1100) is:\n",
+ "1110 \n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_6,pg 490"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Xcess 3 code\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "add = \"0011\" #binary-3 to be added\n",
+ "x = \"0010\" #binary-2\n",
+ "y = \"0100\" #binary-4\n",
+ "z = \"0111\" #binary-7\n",
+ "\n",
+ "#Calculations\n",
+ "x = int(x,2)\n",
+ "add = int(add,2)\n",
+ "XS31=x+add\n",
+ "XS31=bin(XS31)[2:]\n",
+ "y=int(y,2)\n",
+ "XS32=y+add\n",
+ "XS32=bin(XS32)[2:]\n",
+ "z=int(z,2)\n",
+ "XS33=z+add\n",
+ "XS33=bin(XS33)[2:]\n",
+ "\n",
+ "#Result\n",
+ "print(\"XS-3 for 2: %s\"%XS31)\n",
+ "print(\"XS-3 for 4: %s\"%XS32)\n",
+ "print(\"XS-3 for 7: %s\"%XS33)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "XS-3 for 2: 101\n",
+ "XS-3 for 4: 111\n",
+ "XS-3 for 7: 1010\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_7,pg 490"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# 8 to 1 MUX\n",
+ "\n",
+ "# one can see from relations of AND gate outputs in terms of address bits and input bit \n",
+ "# that there are possibilities depending on which input is low\n",
+ "# if I7=0, by making all address bits s1,s2,s3 as 1 one can have the conditions satisfied\n",
+ "\n",
+ "#Result\n",
+ "print(\"This requires all the outputs from AND gates should be low\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "This requires all the outputs from AND gates should be low\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_8,pg 490"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# truth table of RS flip flop\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#enter binary 1-bit values only\n",
+ "\n",
+ "S = input(\"Enter value of S\\n\")\n",
+ "R = input(\"Enter value of R\\n\")\n",
+ "Qn = input(\"Enter previous value of Q\\n\")\n",
+ "En = input(\"Enter enable value\\n\")\n",
+ "print(\"RS flip-flop truth table:\")\n",
+ "if (En==0):\n",
+ " op=Qn\n",
+ " print(\"op = %d\"%op)\n",
+ "elif(( S==0) and (R==0)): \n",
+ " op=Qn\n",
+ " print(\"op = %d\"%op)\n",
+ "elif ((S==0) and (R==1)): \n",
+ " op=0\n",
+ " print(\"op = %d\"%op)\n",
+ "elif((S==1) and (R==0)): \n",
+ " op=1\n",
+ " print(\"op = %d\"%op)\n",
+ "elif ((S==1) and (R==1)): \n",
+ " print(\"output not determinable\")\n",
+ "\n",
+ "print(\"the relations are:\")\n",
+ "print(\"Qn=(R+Qn*)*\") #Q* = not(Q)\n",
+ "print(\"Qn*=(S+Qn)*\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
+ "prompt_number": "*"
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_9,pg 491"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# JK fiip flop\n",
+ "\n",
+ "# Q=(Q*+Q.K)* and Q*=(Q+Q*.J)*\n",
+ "# with J=K=0 Q=Q and Q*=Q*\n",
+ "# Q* is not(Q)\n",
+ "\n",
+ "#Result\n",
+ "print(\"operational equations:\\n\")\n",
+ "print(\"Q=(Q*+Q.K)* and Q*=(Q+Q*.J)*\\n\")\n",
+ "print(\"holds good where Q and Q* should be given appropriate values\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "operational equations:\n",
+ "\n",
+ "Q=(Q*+Q.K)* and Q*=(Q+Q*.J)*\n",
+ "\n",
+ "holds good where Q and Q* should be given appropriate values\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_10,pg 491"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# 3 bit binary counter\n",
+ "\n",
+ "print(\"It remains positive from the falling edge of pulse-2, then falling edge of 4th, 6th and 8th pulses and so on....\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "It remains positive from the falling edge of pulse-2, then falling edge of 4th, 6th and 8th pulses and so on....\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_11,pg 491"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# 6 modulo counter\n",
+ "\n",
+ "print(\"All modulo counters are basically scalars.A 6-modulo counter is a 6-scaler\")\n",
+ "print(\"so that after 6-input pulses the content of counter becomes 000(reset)\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "All modulo counters are basically scalars.A 6-modulo counter is a 6-scaler\n",
+ "so that after 6-input pulses the content of counter becomes 000(reset)\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_12,pg 491"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# 3 bit 5 modulo counter \n",
+ "\n",
+ "print(\"Normal count would be 2^3=8, while 5-modulo counter would limit it to 5, so that illegitimate states are 8-5=3\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Normal count would be 2^3=8, while 5-modulo counter would limit it to 5, so that illegitimate states are 8-5=3\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch4_1.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch4_1.ipynb new file mode 100755 index 00000000..c07461ef --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch4_1.ipynb @@ -0,0 +1,635 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 4 : Combinational And Sequential Logic Circuits"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_1,pg 488"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find output and carry\n",
+ "# it is a half-adder circuit with the output 'a' and carry 'c' given by the boolean equations\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "b1 = 1 #input-1\n",
+ "b2 = 1 #input-2\n",
+ "\n",
+ "#Calculations\n",
+ "a=(b1 and (not b2))+((not b1) and b2) #sum\n",
+ "c=(b1 and b2) #carry\n",
+ "\n",
+ "#Result\n",
+ "print(\"sum:\")\n",
+ "print(\"a = %d\\n\"%a)\n",
+ "print(\"carry:\")\n",
+ "print(\"c = %.f\"%c) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "sum:\n",
+ "a = 0\n",
+ "\n",
+ "carry:\n",
+ "c = 1\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_2,pg 489"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find difference and borrow\n",
+ "#the circuit is that of a half subtractor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "b1 = 1 #input-1, case-1\n",
+ "B1 = 0 #input-2 case-1\n",
+ "b2 = 1 #input-1, case 2\n",
+ "B2 = 1 #input-2, case 2\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "#case-1\n",
+ "d1=(b1 and (not B1))+(B1 and (not b1)) #difference\n",
+ "r1=(b1 and (not B1)) #borrow\n",
+ "\n",
+ "#case-2\n",
+ "d2=(b2 and (not B2))+(B2 and (not b2))\n",
+ "r2=(b2 and (not B2))\n",
+ "\n",
+ "#Result\n",
+ "print(\"difference case-1:\")\n",
+ "print(\"d1 = %d\"%d1)\n",
+ "print(\"borrow case-1:\")\n",
+ "print(\"r1 = %.f\\n\"%r1)\n",
+ "print(\"difference case-2:\")\n",
+ "print(\"d2 = %.f\"%d2)\n",
+ "print(\"borrow case-2:\")\n",
+ "print(\"r2 = %.f\\n\"%r2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "difference case-1:\n",
+ "d1 = 1\n",
+ "borrow case-1:\n",
+ "r1 = 1\n",
+ "\n",
+ "difference case-2:\n",
+ "d2 = 0\n",
+ "borrow case-2:\n",
+ "r2 = 0\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_3,pg 489"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find final output\n",
+ "\n",
+ "import math \n",
+ "#Variable declaration\n",
+ "b=1 #input-1\n",
+ "B=0 #input-2\n",
+ "\n",
+ "#Calculations\n",
+ "y=(not((b or B)) or (b and B))\n",
+ "\n",
+ "#Result\n",
+ "print(\"final output:\")\n",
+ "print(\"y = %d\"%y)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "final output:\n",
+ "y = 0\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_4_a,pg 489"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# decoder output\n",
+ "\n",
+ "import math\n",
+ "#VAriable declaration\n",
+ "#initial conditions\n",
+ "b = 0 # input \n",
+ "Bi = 0 # initial value\n",
+ "Bf = 1 # final value\n",
+ "\n",
+ "#initial state of outputs\n",
+ "\n",
+ "y1i=not(b or Bi)\n",
+ "\n",
+ "y2i=not(b or (not Bi))\n",
+ "\n",
+ "y3i=not(Bi or (not(b)))\n",
+ "\n",
+ "y4i=not((not(Bi)) or (not(b)))\n",
+ "\n",
+ "#final state of outputs\n",
+ "\n",
+ "y1f=not(b or Bf)\n",
+ "\n",
+ "y2f=not(Bf or (not(b)))\n",
+ "\n",
+ "y3f=not(b or (not(Bf)))\n",
+ "\n",
+ "y4f=not((not(Bf)) or (not(b)))\n",
+ "\n",
+ "print(\"first: \")\n",
+ "print(\"y1 = %.f \"%y1i)\n",
+ "print(\"y2 = %.f \"%y2i)\n",
+ "print(\"y3 = %.f \"%y3i)\n",
+ "print(\"y4 = %.f\\n\"%y4i)\n",
+ "print(\"next: \")\n",
+ "print(\"y1 = %.f \"%y1f)\n",
+ "print(\"y2 = %.f \"%y2f)\n",
+ "print(\"y3 = %.f \"%y3f)\n",
+ "print(\"y4 = %.f\"%y4f)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "first: \n",
+ "y1 = 1 \n",
+ "y2 = 0 \n",
+ "y3 = 0 \n",
+ "y4 = 0\n",
+ "\n",
+ "next: \n",
+ "y1 = 0 \n",
+ "y2 = 0 \n",
+ "y3 = 1 \n",
+ "y4 = 0\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_4_b,pg 489"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# decoder output\n",
+ "\n",
+ "import math\n",
+ "#VAriable declaration\n",
+ "#initial conditions\n",
+ "b = 1 # input \n",
+ "Bi = 0 # initial value\n",
+ "Bf = 1 # final value\n",
+ "\n",
+ "#initial state of outputs\n",
+ "\n",
+ "y1i=not(b or Bi)\n",
+ "\n",
+ "y2i=not(Bi or (not(b)))\n",
+ "\n",
+ "y3i=not(b or (not Bi))\n",
+ "\n",
+ "y4i=not((not(Bi)) or (not(b)))\n",
+ "\n",
+ "#final state of outputs\n",
+ "\n",
+ "y1f=not(b or Bf)\n",
+ "\n",
+ "y2f=not(b or (not(Bf)))\n",
+ "\n",
+ "y3f=not(Bf or (not(b)))\n",
+ "\n",
+ "y4f=not((not(Bf)) or (not(b)))\n",
+ "\n",
+ "print(\"first: \")\n",
+ "print(\"y1=%.f \"%y1i)\n",
+ "print(\"y2=%.f \"%y2i)\n",
+ "print(\"y3=%.f \"%y3i)\n",
+ "print(\"y4=%.f\\n\"%y4i)\n",
+ "print(\"next: \")\n",
+ "print(\"y1=%.f \"%y1f)\n",
+ "print(\"y2=%.f \"%y2f)\n",
+ "print(\"y3=%.f \"%y3f)\n",
+ "print(\"y4=%.f\"%y4f)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "first: \n",
+ "y1=0 \n",
+ "y2=1 \n",
+ "y3=0 \n",
+ "y4=0\n",
+ "\n",
+ "next: \n",
+ "y1=0 \n",
+ "y2=0 \n",
+ "y3=0 \n",
+ "y4=1\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_5,pg 489"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# convert 8421 to 2421 code\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#if A8,B8,C8,D8 is the binary in 8421 code, for 12 this would be 1100(DCBA)\n",
+ "#in 8421-code\n",
+ "A8 = 0\n",
+ "B8 = 0\n",
+ "C8 = 1\n",
+ "D8 = 1\n",
+ "\n",
+ "#Calculations\n",
+ "#in 2421-code\n",
+ "D2 = D8\n",
+ "C2 =(C8 or D8)\n",
+ "B2 =(B8 or D8)\n",
+ "A2=A8\n",
+ "\n",
+ "#Result\n",
+ "print(\"2421-code for 12(1100) is:\")\n",
+ "print(\"%d%d%d%d \"%(D2,C2,B2,A2))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2421-code for 12(1100) is:\n",
+ "1110 \n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_6,pg 490"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Xcess 3 code\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "add = \"0011\" #binary-3 to be added\n",
+ "x = \"0010\" #binary-2\n",
+ "y = \"0100\" #binary-4\n",
+ "z = \"0111\" #binary-7\n",
+ "\n",
+ "#Calculations\n",
+ "x = int(x,2)\n",
+ "add = int(add,2)\n",
+ "XS31=x+add\n",
+ "XS31=bin(XS31)[2:]\n",
+ "y=int(y,2)\n",
+ "XS32=y+add\n",
+ "XS32=bin(XS32)[2:]\n",
+ "z=int(z,2)\n",
+ "XS33=z+add\n",
+ "XS33=bin(XS33)[2:]\n",
+ "\n",
+ "#Result\n",
+ "print(\"XS-3 for 2: %s\"%XS31)\n",
+ "print(\"XS-3 for 4: %s\"%XS32)\n",
+ "print(\"XS-3 for 7: %s\"%XS33)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "XS-3 for 2: 101\n",
+ "XS-3 for 4: 111\n",
+ "XS-3 for 7: 1010\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_7,pg 490"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# 8 to 1 MUX\n",
+ "\n",
+ "# one can see from relations of AND gate outputs in terms of address bits and input bit \n",
+ "# that there are possibilities depending on which input is low\n",
+ "# if I7=0, by making all address bits s1,s2,s3 as 1 one can have the conditions satisfied\n",
+ "\n",
+ "#Result\n",
+ "print(\"This requires all the outputs from AND gates should be low\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "This requires all the outputs from AND gates should be low\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_8,pg 490"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# truth table of RS flip flop\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#enter binary 1-bit values only\n",
+ "\n",
+ "S = input(\"Enter value of S\\n\")\n",
+ "R = input(\"Enter value of R\\n\")\n",
+ "Qn = input(\"Enter previous value of Q\\n\")\n",
+ "En = input(\"Enter enable value\\n\")\n",
+ "print(\"RS flip-flop truth table:\")\n",
+ "if (En==0):\n",
+ " op=Qn\n",
+ " print(\"op = %d\"%op)\n",
+ "elif(( S==0) and (R==0)): \n",
+ " op=Qn\n",
+ " print(\"op = %d\"%op)\n",
+ "elif ((S==0) and (R==1)): \n",
+ " op=0\n",
+ " print(\"op = %d\"%op)\n",
+ "elif((S==1) and (R==0)): \n",
+ " op=1\n",
+ " print(\"op = %d\"%op)\n",
+ "elif ((S==1) and (R==1)): \n",
+ " print(\"output not determinable\")\n",
+ "\n",
+ "print(\"the relations are:\")\n",
+ "print(\"Qn=(R+Qn*)*\") #Q* = not(Q)\n",
+ "print(\"Qn*=(S+Qn)*\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
+ "prompt_number": "*"
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_9,pg 491"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# JK fiip flop\n",
+ "\n",
+ "# Q=(Q*+Q.K)* and Q*=(Q+Q*.J)*\n",
+ "# with J=K=0 Q=Q and Q*=Q*\n",
+ "# Q* is not(Q)\n",
+ "\n",
+ "#Result\n",
+ "print(\"operational equations:\\n\")\n",
+ "print(\"Q=(Q*+Q.K)* and Q*=(Q+Q*.J)*\\n\")\n",
+ "print(\"holds good where Q and Q* should be given appropriate values\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "operational equations:\n",
+ "\n",
+ "Q=(Q*+Q.K)* and Q*=(Q+Q*.J)*\n",
+ "\n",
+ "holds good where Q and Q* should be given appropriate values\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_10,pg 491"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# 3 bit binary counter\n",
+ "\n",
+ "print(\"It remains positive from the falling edge of pulse-2, then falling edge of 4th, 6th and 8th pulses and so on....\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "It remains positive from the falling edge of pulse-2, then falling edge of 4th, 6th and 8th pulses and so on....\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_11,pg 491"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# 6 modulo counter\n",
+ "\n",
+ "print(\"All modulo counters are basically scalars.A 6-modulo counter is a 6-scaler\")\n",
+ "print(\"so that after 6-input pulses the content of counter becomes 000(reset)\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "All modulo counters are basically scalars.A 6-modulo counter is a 6-scaler\n",
+ "so that after 6-input pulses the content of counter becomes 000(reset)\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_12,pg 491"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# 3 bit 5 modulo counter \n",
+ "\n",
+ "print(\"Normal count would be 2^3=8, while 5-modulo counter would limit it to 5, so that illegitimate states are 8-5=3\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Normal count would be 2^3=8, while 5-modulo counter would limit it to 5, so that illegitimate states are 8-5=3\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch4_2.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch4_2.ipynb new file mode 100755 index 00000000..3cfa4df3 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch4_2.ipynb @@ -0,0 +1,683 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 4 : Combinational And Sequential Logic Circuits"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_1,pg 488"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find output and carry\n",
+ "# it is a half-adder circuit with the output 'a' and carry 'c' given by the boolean equations\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "b1 = 1 #input-1\n",
+ "b2 = 1 #input-2\n",
+ "\n",
+ "#Calculations\n",
+ "a=(b1 and (not b2))+((not b1) and b2) #sum\n",
+ "c=(b1 and b2) #carry\n",
+ "\n",
+ "#Result\n",
+ "print(\"sum:\")\n",
+ "print(\"a = %d\\n\"%a)\n",
+ "print(\"carry:\")\n",
+ "print(\"c = %.f\"%c) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "sum:\n",
+ "a = 0\n",
+ "\n",
+ "carry:\n",
+ "c = 1\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_2,pg 489"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find difference and borrow\n",
+ "#the circuit is that of a half subtractor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "b1 = 1 #input-1, case-1\n",
+ "B1 = 0 #input-2 case-1\n",
+ "b2 = 1 #input-1, case 2\n",
+ "B2 = 1 #input-2, case 2\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "#case-1\n",
+ "d1=(b1 and (not B1))+(B1 and (not b1)) #difference\n",
+ "r1=(b1 and (not B1)) #borrow\n",
+ "\n",
+ "#case-2\n",
+ "d2=(b2 and (not B2))+(B2 and (not b2))\n",
+ "r2=(b2 and (not B2))\n",
+ "\n",
+ "#Result\n",
+ "print(\"difference case-1:\")\n",
+ "print(\"d1 = %d\"%d1)\n",
+ "print(\"borrow case-1:\")\n",
+ "print(\"r1 = %.f\\n\"%r1)\n",
+ "print(\"difference case-2:\")\n",
+ "print(\"d2 = %.f\"%d2)\n",
+ "print(\"borrow case-2:\")\n",
+ "print(\"r2 = %.f\\n\"%r2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "difference case-1:\n",
+ "d1 = 1\n",
+ "borrow case-1:\n",
+ "r1 = 1\n",
+ "\n",
+ "difference case-2:\n",
+ "d2 = 0\n",
+ "borrow case-2:\n",
+ "r2 = 0\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_3,pg 489"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find final output\n",
+ "\n",
+ "import math \n",
+ "#Variable declaration\n",
+ "b=1 #input-1\n",
+ "B=0 #input-2\n",
+ "\n",
+ "#Calculations\n",
+ "y=(not((b or B)) or (b and B))\n",
+ "\n",
+ "#Result\n",
+ "print(\"final output:\")\n",
+ "print(\"y = %d\"%y)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "final output:\n",
+ "y = 0\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_4_a,pg 489"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# decoder output\n",
+ "\n",
+ "import math\n",
+ "#VAriable declaration\n",
+ "#initial conditions\n",
+ "b = 0 # input \n",
+ "Bi = 0 # initial value\n",
+ "Bf = 1 # final value\n",
+ "\n",
+ "#initial state of outputs\n",
+ "\n",
+ "y1i=not(b or Bi)\n",
+ "\n",
+ "y2i=not(b or (not Bi))\n",
+ "\n",
+ "y3i=not(Bi or (not(b)))\n",
+ "\n",
+ "y4i=not((not(Bi)) or (not(b)))\n",
+ "\n",
+ "#final state of outputs\n",
+ "\n",
+ "y1f=not(b or Bf)\n",
+ "\n",
+ "y2f=not(Bf or (not(b)))\n",
+ "\n",
+ "y3f=not(b or (not(Bf)))\n",
+ "\n",
+ "y4f=not((not(Bf)) or (not(b)))\n",
+ "\n",
+ "print(\"first: \")\n",
+ "print(\"y1 = %.f \"%y1i)\n",
+ "print(\"y2 = %.f \"%y2i)\n",
+ "print(\"y3 = %.f \"%y3i)\n",
+ "print(\"y4 = %.f\\n\"%y4i)\n",
+ "print(\"next: \")\n",
+ "print(\"y1 = %.f \"%y1f)\n",
+ "print(\"y2 = %.f \"%y2f)\n",
+ "print(\"y3 = %.f \"%y3f)\n",
+ "print(\"y4 = %.f\"%y4f)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "first: \n",
+ "y1 = 1 \n",
+ "y2 = 0 \n",
+ "y3 = 0 \n",
+ "y4 = 0\n",
+ "\n",
+ "next: \n",
+ "y1 = 0 \n",
+ "y2 = 0 \n",
+ "y3 = 1 \n",
+ "y4 = 0\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_4_b,pg 489"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# decoder output\n",
+ "\n",
+ "import math\n",
+ "#VAriable declaration\n",
+ "#initial conditions\n",
+ "b = 1 # input \n",
+ "Bi = 0 # initial value\n",
+ "Bf = 1 # final value\n",
+ "\n",
+ "#initial state of outputs\n",
+ "\n",
+ "y1i=not(b or Bi)\n",
+ "\n",
+ "y2i=not(Bi or (not(b)))\n",
+ "\n",
+ "y3i=not(b or (not Bi))\n",
+ "\n",
+ "y4i=not((not(Bi)) or (not(b)))\n",
+ "\n",
+ "#final state of outputs\n",
+ "\n",
+ "y1f=not(b or Bf)\n",
+ "\n",
+ "y2f=not(b or (not(Bf)))\n",
+ "\n",
+ "y3f=not(Bf or (not(b)))\n",
+ "\n",
+ "y4f=not((not(Bf)) or (not(b)))\n",
+ "\n",
+ "print(\"first: \")\n",
+ "print(\"y1=%.f \"%y1i)\n",
+ "print(\"y2=%.f \"%y2i)\n",
+ "print(\"y3=%.f \"%y3i)\n",
+ "print(\"y4=%.f\\n\"%y4i)\n",
+ "print(\"next: \")\n",
+ "print(\"y1=%.f \"%y1f)\n",
+ "print(\"y2=%.f \"%y2f)\n",
+ "print(\"y3=%.f \"%y3f)\n",
+ "print(\"y4=%.f\"%y4f)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "first: \n",
+ "y1=0 \n",
+ "y2=1 \n",
+ "y3=0 \n",
+ "y4=0\n",
+ "\n",
+ "next: \n",
+ "y1=0 \n",
+ "y2=0 \n",
+ "y3=0 \n",
+ "y4=1\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_5,pg 489"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# convert 8421 to 2421 code\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#if A8,B8,C8,D8 is the binary in 8421 code, for 12 this would be 1100(DCBA)\n",
+ "#in 8421-code\n",
+ "A8 = 0\n",
+ "B8 = 0\n",
+ "C8 = 1\n",
+ "D8 = 1\n",
+ "\n",
+ "#Calculations\n",
+ "#in 2421-code\n",
+ "D2 = D8\n",
+ "C2 =(C8 or D8)\n",
+ "B2 =(B8 or D8)\n",
+ "A2=A8\n",
+ "\n",
+ "#Result\n",
+ "print(\"2421-code for 12(1100) is:\")\n",
+ "print(\"%d%d%d%d \"%(D2,C2,B2,A2))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2421-code for 12(1100) is:\n",
+ "1110 \n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_6,pg 490"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Xcess 3 code\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "add = \"0011\" #binary-3 to be added\n",
+ "x = \"0010\" #binary-2\n",
+ "y = \"0100\" #binary-4\n",
+ "z = \"0111\" #binary-7\n",
+ "\n",
+ "#Calculations\n",
+ "x = int(x,2)\n",
+ "add = int(add,2)\n",
+ "XS31=x+add\n",
+ "XS31=bin(XS31)[2:]\n",
+ "y=int(y,2)\n",
+ "XS32=y+add\n",
+ "XS32=bin(XS32)[2:]\n",
+ "z=int(z,2)\n",
+ "XS33=z+add\n",
+ "XS33=bin(XS33)[2:]\n",
+ "\n",
+ "#Result\n",
+ "print(\"XS-3 for 2: %s\"%XS31)\n",
+ "print(\"XS-3 for 4: %s\"%XS32)\n",
+ "print(\"XS-3 for 7: %s\"%XS33)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "XS-3 for 2: 101\n",
+ "XS-3 for 4: 111\n",
+ "XS-3 for 7: 1010\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_7,pg 490"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# 8 to 1 MUX\n",
+ "\n",
+ "# one can see from relations of AND gate outputs in terms of address bits and input bit \n",
+ "# that there are possibilities depending on which input is low\n",
+ "# if I7=0, by making all address bits s1,s2,s3 as 1 one can have the conditions satisfied\n",
+ "\n",
+ "#Result\n",
+ "print(\"This requires all the outputs from AND gates should be low\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "This requires all the outputs from AND gates should be low\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_8,pg 490"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# truth table of RS flip flop\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#enter binary 1-bit values only\n",
+ "\n",
+ "S = input(\"Enter value of S\\n\")\n",
+ "R = input(\"Enter value of R\\n\")\n",
+ "Qn = input(\"Enter previous value of Q\\n\")\n",
+ "En = input(\"Enter enable value\\n\")\n",
+ "print(\"RS flip-flop truth table:\")\n",
+ "if (En==0):\n",
+ " op=Qn\n",
+ " print(\"op = %d\"%op)\n",
+ "elif(( S==0) and (R==0)): \n",
+ " op=Qn\n",
+ " print(\"op = %d\"%op)\n",
+ "elif ((S==0) and (R==1)): \n",
+ " op=0\n",
+ " print(\"op = %d\"%op)\n",
+ "elif((S==1) and (R==0)): \n",
+ " op=1\n",
+ " print(\"op = %d\"%op)\n",
+ "elif ((S==1) and (R==1)): \n",
+ " print(\"output not determinable\")\n",
+ "\n",
+ "print(\"the relations are:\")\n",
+ "print(\"Qn=(R+Qn*)*\") #Q* = not(Q)\n",
+ "print(\"Qn*=(S+Qn)*\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter value of S\n",
+ "1\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter value of R\n",
+ "0\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter previous value of Q\n",
+ "1\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter enable value\n",
+ "1\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "RS flip-flop truth table:\n",
+ "op = 1\n",
+ "the relations are:\n",
+ "Qn=(R+Qn*)*\n",
+ "Qn*=(S+Qn)*\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_9,pg 491"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# JK fiip flop\n",
+ "\n",
+ "# Q=(Q*+Q.K)* and Q*=(Q+Q*.J)*\n",
+ "# with J=K=0 Q=Q and Q*=Q*\n",
+ "# Q* is not(Q)\n",
+ "\n",
+ "#Result\n",
+ "print(\"operational equations:\\n\")\n",
+ "print(\"Q=(Q*+Q.K)* and Q*=(Q+Q*.J)*\\n\")\n",
+ "print(\"holds good where Q and Q* should be given appropriate values\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "operational equations:\n",
+ "\n",
+ "Q=(Q*+Q.K)* and Q*=(Q+Q*.J)*\n",
+ "\n",
+ "holds good where Q and Q* should be given appropriate values\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_10,pg 491"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# 3 bit binary counter\n",
+ "\n",
+ "print(\"It remains positive from the falling edge of pulse-2, then falling edge of 4th, 6th and 8th pulses and so on....\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "It remains positive from the falling edge of pulse-2, then falling edge of 4th, 6th and 8th pulses and so on....\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_11,pg 491"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# 6 modulo counter\n",
+ "\n",
+ "print(\"All modulo counters are basically scalars.A 6-modulo counter is a 6-scaler\")\n",
+ "print(\"so that after 6-input pulses the content of counter becomes 000(reset)\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "All modulo counters are basically scalars.A 6-modulo counter is a 6-scaler\n",
+ "so that after 6-input pulses the content of counter becomes 000(reset)\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4_12,pg 491"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# 3 bit 5 modulo counter \n",
+ "\n",
+ "print(\"Normal count would be 2^3=8, while 5-modulo counter would limit it to 5, so that illegitimate states are 8-5=3\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Normal count would be 2^3=8, while 5-modulo counter would limit it to 5, so that illegitimate states are 8-5=3\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch5.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch5.ipynb new file mode 100755 index 00000000..c194e95b --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch5.ipynb @@ -0,0 +1,446 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 5: ADC and DAC"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_1,pg 491"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# output voltage\n",
+ "\n",
+ "import math\n",
+ "# Variable declaration\n",
+ "Vref=12.0 #ref. voltage\n",
+ "n =4.0 #no. of binary weighted resistors\n",
+ "n1=3.0 #input-1\n",
+ "n2=1.0 #input-2\n",
+ "\n",
+ "#Calculations\n",
+ "Vo=-(Vref/2**n)*(2**n1+2**n2)\n",
+ "\n",
+ "#Result \n",
+ "print(\"output voltage:\")\n",
+ "print(\"Vo = %.1f V\"%Vo) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output voltage:\n",
+ "Vo = -7.5 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_2,pg 491"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# voltage division ratio and feedback resistor\n",
+ "\n",
+ "import math\n",
+ "# Variabe declaration \n",
+ "# serie arm resistance = 10k, since the divider arm resistance Rsh=2Rse \n",
+ "# therefore for straight binary code, one should have section voltage ratio as Vos/Vis=0.5\n",
+ "\n",
+ "#Vo/Vref=0.5\n",
+ "Rse=10*10**3 #series resistance(Rsh/2)\n",
+ "\n",
+ "#Calculation\n",
+ "Rf=0.5*(16*Rse)/15 #feedback resistor\n",
+ "\n",
+ "#Result\n",
+ "print(\"voltage section ratio = 0.5\")\n",
+ "print(\"\\nfeedback resistor:\")\n",
+ "print(\"Rf = %.2f k-ohm\"%(Rf/1000)) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "voltage section ratio = 0.5\n",
+ "\n",
+ "feedback resistor:\n",
+ "Rf = 5.33 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_3,pg 492"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# output voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Rse = 1*10**3 #series resistance\n",
+ "Rsh = 2*10**3 #shunt resistance\n",
+ "Vref= 5.0 #ref. voltage\n",
+ "n1 = 0 #input-1\n",
+ "n2 = 3 #input-2\n",
+ "Ro=0.22*10**3 #load resistance\n",
+ "\n",
+ "#Calculations\n",
+ "Vo=(Vref*(2**n1+2**n2)/16)*(Ro/(Ro+Rsh))\n",
+ "\n",
+ "#Result\n",
+ "print(\"output voltage:\")\n",
+ "print(\"Vo = %.3f V\"%(math.floor(Vo*1000)/1000)) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output voltage:\n",
+ "Vo = 0.278 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_4,pg 492"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find count\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vref=5.0 #ref. voltage\n",
+ "t=1*10**-3 #sawtooth wave time\n",
+ "f=100*10**3 #clock frequency\n",
+ "Vi=1 #input voltage\n",
+ "\n",
+ "#Calculations\n",
+ "N=((t*f*Vi)/Vref) #count\n",
+ "\n",
+ "#Result\n",
+ "print(\"count = %d\"%N)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "count = 20\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_5,pg 492"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find integrator output voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Tu=1*10**-3 #wave time\n",
+ "Vi=0.2 #input voltage\n",
+ "t=4*10**-3 #integration time constant(1/RC)\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "V1=((Vi*Tu)/t) #integrator output voltage\n",
+ "\n",
+ "#Result\n",
+ "print(\"integrator output voltage:\")\n",
+ "print(\"V1 = %.2f V\"%V1) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "integrator output voltage:\n",
+ "V1 = 0.05 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_6,pg 493"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find rise in output voltage and charging time\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Tz=0.6*10**-3 #discharge time\n",
+ "Vref=1 #ref. voltage\n",
+ "t=4*10**-3 #integrator time const.\n",
+ "Vi=0.2 #input voltage\n",
+ "#Calculations\n",
+ "Vk=((Vref*Tz)/t) #rise in output integrator\n",
+ "Tu=Vref*(Tz/Vi) #charging time\n",
+ "\n",
+ "#Result\n",
+ "print(\"Rise in integrator output:\")\n",
+ "print(\"Vk = %.2f V\\n\"%Vk)\n",
+ "print(\"charging time:\")\n",
+ "print(\"Tu = %.0f msec\"%(Tu*1000)) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rise in integrator output:\n",
+ "Vk = 0.15 V\n",
+ "\n",
+ "charging time:\n",
+ "Tu = 3 msec\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_7,pg 493"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find count of counter\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vref=1 #ref. voltage\n",
+ "Vi=0.2 #input voltage\n",
+ "n=15 #no. of counts before reset(n+1)\n",
+ "\n",
+ "#Calculations\n",
+ "N=((n+1)*Vi)/Vref #no.of counts over charging time\n",
+ "\n",
+ "print(\"No of counts over charging time:\")\n",
+ "print(\"N = %.1f = %d(approx.) \"%(N,N)) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "No of counts over charging time:\n",
+ "N = 3.2 = 3(approx.) \n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_8,pg 493"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find input voltage\n",
+ "\n",
+ "import math\n",
+ "Nx=2**6 #6 bit counteer register\n",
+ "Vref=2.2 #ref. voltage\n",
+ "N=32.0 #SAR output\n",
+ "\n",
+ "#Calculations\n",
+ "Vi=(N/(Nx+1)*Vref) #input voltage\n",
+ "\n",
+ "#Result\n",
+ "print(\"Input Voltage:\")\n",
+ "print(\"Vi = %.2f V\"%Vi) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Input Voltage:\n",
+ "Vi = 1.08 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_9,pg 493"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# conversion number\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "n=3 #3-bit ADC\n",
+ "Vref=2.2 #ref.voltage\n",
+ "Vi=1 #input voltage\n",
+ "\n",
+ "#Calculations\n",
+ "N=(((2**n)-1)*Vi)/Vref #SAR output\n",
+ "\n",
+ "#Result\n",
+ "print(\"SAR conversion no.:\")\n",
+ "print(\"N = %.2f \"%N) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "SAR conversion no.:\n",
+ "N = 3.18 \n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_10,pg 493"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# signal to noise ratio\n",
+ "\n",
+ "import math\n",
+ "#Variable declaaration\n",
+ "n = 3.0 #3-bit ADC\n",
+ "\n",
+ "#Calculations\n",
+ "SbyN=(((2**(n-1)*12**0.5)/2**0.5)) #S/N ratio\n",
+ "\n",
+ "#Result\n",
+ "print(\"S/N ratio:\")\n",
+ "print(\"SbyN = %.3f\\n\"%SbyN) \n",
+ "print(\"This produces an error due to noise nearly 10%\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "S/N ratio:\n",
+ "SbyN = 9.798\n",
+ "\n",
+ "This produces an error due to noise nearly 10%\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch5_1.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch5_1.ipynb new file mode 100755 index 00000000..c194e95b --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch5_1.ipynb @@ -0,0 +1,446 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 5: ADC and DAC"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_1,pg 491"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# output voltage\n",
+ "\n",
+ "import math\n",
+ "# Variable declaration\n",
+ "Vref=12.0 #ref. voltage\n",
+ "n =4.0 #no. of binary weighted resistors\n",
+ "n1=3.0 #input-1\n",
+ "n2=1.0 #input-2\n",
+ "\n",
+ "#Calculations\n",
+ "Vo=-(Vref/2**n)*(2**n1+2**n2)\n",
+ "\n",
+ "#Result \n",
+ "print(\"output voltage:\")\n",
+ "print(\"Vo = %.1f V\"%Vo) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output voltage:\n",
+ "Vo = -7.5 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_2,pg 491"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# voltage division ratio and feedback resistor\n",
+ "\n",
+ "import math\n",
+ "# Variabe declaration \n",
+ "# serie arm resistance = 10k, since the divider arm resistance Rsh=2Rse \n",
+ "# therefore for straight binary code, one should have section voltage ratio as Vos/Vis=0.5\n",
+ "\n",
+ "#Vo/Vref=0.5\n",
+ "Rse=10*10**3 #series resistance(Rsh/2)\n",
+ "\n",
+ "#Calculation\n",
+ "Rf=0.5*(16*Rse)/15 #feedback resistor\n",
+ "\n",
+ "#Result\n",
+ "print(\"voltage section ratio = 0.5\")\n",
+ "print(\"\\nfeedback resistor:\")\n",
+ "print(\"Rf = %.2f k-ohm\"%(Rf/1000)) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "voltage section ratio = 0.5\n",
+ "\n",
+ "feedback resistor:\n",
+ "Rf = 5.33 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_3,pg 492"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# output voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Rse = 1*10**3 #series resistance\n",
+ "Rsh = 2*10**3 #shunt resistance\n",
+ "Vref= 5.0 #ref. voltage\n",
+ "n1 = 0 #input-1\n",
+ "n2 = 3 #input-2\n",
+ "Ro=0.22*10**3 #load resistance\n",
+ "\n",
+ "#Calculations\n",
+ "Vo=(Vref*(2**n1+2**n2)/16)*(Ro/(Ro+Rsh))\n",
+ "\n",
+ "#Result\n",
+ "print(\"output voltage:\")\n",
+ "print(\"Vo = %.3f V\"%(math.floor(Vo*1000)/1000)) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output voltage:\n",
+ "Vo = 0.278 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_4,pg 492"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find count\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vref=5.0 #ref. voltage\n",
+ "t=1*10**-3 #sawtooth wave time\n",
+ "f=100*10**3 #clock frequency\n",
+ "Vi=1 #input voltage\n",
+ "\n",
+ "#Calculations\n",
+ "N=((t*f*Vi)/Vref) #count\n",
+ "\n",
+ "#Result\n",
+ "print(\"count = %d\"%N)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "count = 20\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_5,pg 492"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find integrator output voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Tu=1*10**-3 #wave time\n",
+ "Vi=0.2 #input voltage\n",
+ "t=4*10**-3 #integration time constant(1/RC)\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "V1=((Vi*Tu)/t) #integrator output voltage\n",
+ "\n",
+ "#Result\n",
+ "print(\"integrator output voltage:\")\n",
+ "print(\"V1 = %.2f V\"%V1) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "integrator output voltage:\n",
+ "V1 = 0.05 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_6,pg 493"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find rise in output voltage and charging time\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Tz=0.6*10**-3 #discharge time\n",
+ "Vref=1 #ref. voltage\n",
+ "t=4*10**-3 #integrator time const.\n",
+ "Vi=0.2 #input voltage\n",
+ "#Calculations\n",
+ "Vk=((Vref*Tz)/t) #rise in output integrator\n",
+ "Tu=Vref*(Tz/Vi) #charging time\n",
+ "\n",
+ "#Result\n",
+ "print(\"Rise in integrator output:\")\n",
+ "print(\"Vk = %.2f V\\n\"%Vk)\n",
+ "print(\"charging time:\")\n",
+ "print(\"Tu = %.0f msec\"%(Tu*1000)) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rise in integrator output:\n",
+ "Vk = 0.15 V\n",
+ "\n",
+ "charging time:\n",
+ "Tu = 3 msec\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_7,pg 493"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find count of counter\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vref=1 #ref. voltage\n",
+ "Vi=0.2 #input voltage\n",
+ "n=15 #no. of counts before reset(n+1)\n",
+ "\n",
+ "#Calculations\n",
+ "N=((n+1)*Vi)/Vref #no.of counts over charging time\n",
+ "\n",
+ "print(\"No of counts over charging time:\")\n",
+ "print(\"N = %.1f = %d(approx.) \"%(N,N)) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "No of counts over charging time:\n",
+ "N = 3.2 = 3(approx.) \n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_8,pg 493"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find input voltage\n",
+ "\n",
+ "import math\n",
+ "Nx=2**6 #6 bit counteer register\n",
+ "Vref=2.2 #ref. voltage\n",
+ "N=32.0 #SAR output\n",
+ "\n",
+ "#Calculations\n",
+ "Vi=(N/(Nx+1)*Vref) #input voltage\n",
+ "\n",
+ "#Result\n",
+ "print(\"Input Voltage:\")\n",
+ "print(\"Vi = %.2f V\"%Vi) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Input Voltage:\n",
+ "Vi = 1.08 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_9,pg 493"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# conversion number\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "n=3 #3-bit ADC\n",
+ "Vref=2.2 #ref.voltage\n",
+ "Vi=1 #input voltage\n",
+ "\n",
+ "#Calculations\n",
+ "N=(((2**n)-1)*Vi)/Vref #SAR output\n",
+ "\n",
+ "#Result\n",
+ "print(\"SAR conversion no.:\")\n",
+ "print(\"N = %.2f \"%N) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "SAR conversion no.:\n",
+ "N = 3.18 \n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_10,pg 493"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# signal to noise ratio\n",
+ "\n",
+ "import math\n",
+ "#Variable declaaration\n",
+ "n = 3.0 #3-bit ADC\n",
+ "\n",
+ "#Calculations\n",
+ "SbyN=(((2**(n-1)*12**0.5)/2**0.5)) #S/N ratio\n",
+ "\n",
+ "#Result\n",
+ "print(\"S/N ratio:\")\n",
+ "print(\"SbyN = %.3f\\n\"%SbyN) \n",
+ "print(\"This produces an error due to noise nearly 10%\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "S/N ratio:\n",
+ "SbyN = 9.798\n",
+ "\n",
+ "This produces an error due to noise nearly 10%\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch5_2.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch5_2.ipynb new file mode 100755 index 00000000..c194e95b --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch5_2.ipynb @@ -0,0 +1,446 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 5: ADC and DAC"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_1,pg 491"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# output voltage\n",
+ "\n",
+ "import math\n",
+ "# Variable declaration\n",
+ "Vref=12.0 #ref. voltage\n",
+ "n =4.0 #no. of binary weighted resistors\n",
+ "n1=3.0 #input-1\n",
+ "n2=1.0 #input-2\n",
+ "\n",
+ "#Calculations\n",
+ "Vo=-(Vref/2**n)*(2**n1+2**n2)\n",
+ "\n",
+ "#Result \n",
+ "print(\"output voltage:\")\n",
+ "print(\"Vo = %.1f V\"%Vo) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output voltage:\n",
+ "Vo = -7.5 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_2,pg 491"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# voltage division ratio and feedback resistor\n",
+ "\n",
+ "import math\n",
+ "# Variabe declaration \n",
+ "# serie arm resistance = 10k, since the divider arm resistance Rsh=2Rse \n",
+ "# therefore for straight binary code, one should have section voltage ratio as Vos/Vis=0.5\n",
+ "\n",
+ "#Vo/Vref=0.5\n",
+ "Rse=10*10**3 #series resistance(Rsh/2)\n",
+ "\n",
+ "#Calculation\n",
+ "Rf=0.5*(16*Rse)/15 #feedback resistor\n",
+ "\n",
+ "#Result\n",
+ "print(\"voltage section ratio = 0.5\")\n",
+ "print(\"\\nfeedback resistor:\")\n",
+ "print(\"Rf = %.2f k-ohm\"%(Rf/1000)) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "voltage section ratio = 0.5\n",
+ "\n",
+ "feedback resistor:\n",
+ "Rf = 5.33 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_3,pg 492"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# output voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Rse = 1*10**3 #series resistance\n",
+ "Rsh = 2*10**3 #shunt resistance\n",
+ "Vref= 5.0 #ref. voltage\n",
+ "n1 = 0 #input-1\n",
+ "n2 = 3 #input-2\n",
+ "Ro=0.22*10**3 #load resistance\n",
+ "\n",
+ "#Calculations\n",
+ "Vo=(Vref*(2**n1+2**n2)/16)*(Ro/(Ro+Rsh))\n",
+ "\n",
+ "#Result\n",
+ "print(\"output voltage:\")\n",
+ "print(\"Vo = %.3f V\"%(math.floor(Vo*1000)/1000)) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "output voltage:\n",
+ "Vo = 0.278 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_4,pg 492"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find count\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vref=5.0 #ref. voltage\n",
+ "t=1*10**-3 #sawtooth wave time\n",
+ "f=100*10**3 #clock frequency\n",
+ "Vi=1 #input voltage\n",
+ "\n",
+ "#Calculations\n",
+ "N=((t*f*Vi)/Vref) #count\n",
+ "\n",
+ "#Result\n",
+ "print(\"count = %d\"%N)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "count = 20\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_5,pg 492"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find integrator output voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Tu=1*10**-3 #wave time\n",
+ "Vi=0.2 #input voltage\n",
+ "t=4*10**-3 #integration time constant(1/RC)\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "V1=((Vi*Tu)/t) #integrator output voltage\n",
+ "\n",
+ "#Result\n",
+ "print(\"integrator output voltage:\")\n",
+ "print(\"V1 = %.2f V\"%V1) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "integrator output voltage:\n",
+ "V1 = 0.05 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_6,pg 493"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find rise in output voltage and charging time\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Tz=0.6*10**-3 #discharge time\n",
+ "Vref=1 #ref. voltage\n",
+ "t=4*10**-3 #integrator time const.\n",
+ "Vi=0.2 #input voltage\n",
+ "#Calculations\n",
+ "Vk=((Vref*Tz)/t) #rise in output integrator\n",
+ "Tu=Vref*(Tz/Vi) #charging time\n",
+ "\n",
+ "#Result\n",
+ "print(\"Rise in integrator output:\")\n",
+ "print(\"Vk = %.2f V\\n\"%Vk)\n",
+ "print(\"charging time:\")\n",
+ "print(\"Tu = %.0f msec\"%(Tu*1000)) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rise in integrator output:\n",
+ "Vk = 0.15 V\n",
+ "\n",
+ "charging time:\n",
+ "Tu = 3 msec\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_7,pg 493"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find count of counter\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vref=1 #ref. voltage\n",
+ "Vi=0.2 #input voltage\n",
+ "n=15 #no. of counts before reset(n+1)\n",
+ "\n",
+ "#Calculations\n",
+ "N=((n+1)*Vi)/Vref #no.of counts over charging time\n",
+ "\n",
+ "print(\"No of counts over charging time:\")\n",
+ "print(\"N = %.1f = %d(approx.) \"%(N,N)) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "No of counts over charging time:\n",
+ "N = 3.2 = 3(approx.) \n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_8,pg 493"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find input voltage\n",
+ "\n",
+ "import math\n",
+ "Nx=2**6 #6 bit counteer register\n",
+ "Vref=2.2 #ref. voltage\n",
+ "N=32.0 #SAR output\n",
+ "\n",
+ "#Calculations\n",
+ "Vi=(N/(Nx+1)*Vref) #input voltage\n",
+ "\n",
+ "#Result\n",
+ "print(\"Input Voltage:\")\n",
+ "print(\"Vi = %.2f V\"%Vi) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Input Voltage:\n",
+ "Vi = 1.08 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_9,pg 493"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# conversion number\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "n=3 #3-bit ADC\n",
+ "Vref=2.2 #ref.voltage\n",
+ "Vi=1 #input voltage\n",
+ "\n",
+ "#Calculations\n",
+ "N=(((2**n)-1)*Vi)/Vref #SAR output\n",
+ "\n",
+ "#Result\n",
+ "print(\"SAR conversion no.:\")\n",
+ "print(\"N = %.2f \"%N) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "SAR conversion no.:\n",
+ "N = 3.18 \n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5_10,pg 493"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# signal to noise ratio\n",
+ "\n",
+ "import math\n",
+ "#Variable declaaration\n",
+ "n = 3.0 #3-bit ADC\n",
+ "\n",
+ "#Calculations\n",
+ "SbyN=(((2**(n-1)*12**0.5)/2**0.5)) #S/N ratio\n",
+ "\n",
+ "#Result\n",
+ "print(\"S/N ratio:\")\n",
+ "print(\"SbyN = %.3f\\n\"%SbyN) \n",
+ "print(\"This produces an error due to noise nearly 10%\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "S/N ratio:\n",
+ "SbyN = 9.798\n",
+ "\n",
+ "This produces an error due to noise nearly 10%\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch6.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch6.ipynb new file mode 100755 index 00000000..20a99fec --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch6.ipynb @@ -0,0 +1,541 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 6 : Cathode Ray Oscilloscope"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_1,pg 169"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Time required for each conversion\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "n = 8.0 #8-bit resolution(conversion of 1 in 256)\n",
+ "Tr = 10.0*10**-6 #total trace time(256 conversions in 10*10^-6 s)\n",
+ "Nc = 256.0 #total conversions\n",
+ "\n",
+ "#Calculations\n",
+ "S = (Tr/Nc) #speed of ADC\n",
+ "\n",
+ "#Result\n",
+ "print(\"Time required for each conversion = %d ns\"%(S*10**9))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Time required for each conversion = 39 ns\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Example6_2,pg 178"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find frequency at horizontal plate\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fy=1.8*10**3 #frequency at vertical plates\n",
+ "Nv=2.0 #vertical tangencies\n",
+ "Nh=3.0 #horizontal tangencies\n",
+ "\n",
+ "#Calculations\n",
+ "fx=fy*(Nv/Nh) #frequency at horizontal plates\n",
+ "\n",
+ "#Result\n",
+ "print(\"frequency of other wave:\")\n",
+ "print(\"fx = %.1f kHz\"%(fx/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "frequency of other wave:\n",
+ "fx = 1.2 kHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_3,pg 178"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find length of vertical axis of ellipse\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "phi = math.pi*30/180 #conversion into radian\n",
+ "bplus = 3 #ellipse cutting +ve minor axis\n",
+ "bminus=-3 #ellipse cutting -ve minor axis\n",
+ "\n",
+ "#Calculations\n",
+ "theta = math.atan(2.0/1.0) #angle of major axis of ellipse(Vy/Vh=2:1)\n",
+ "y1=(bplus/math.sin(phi)) #length of vertical axis\n",
+ " \n",
+ "\n",
+ "#Result\n",
+ "print(\"length of vertical axis:\")\n",
+ "print(\"y1 = (+/-)%.2f cm\"%y1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "length of vertical axis:\n",
+ "y1 = (+/-)6.00 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_4,pg 493"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find voltage applied between plates\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "d=1*10**-3 #separation between plates\n",
+ "fe=300 #acceleration of electron\n",
+ "e=1.6*10**-19 #charge of 1 electron\n",
+ "me=9.1*10**-31 #mass of 1 electron\n",
+ "\n",
+ "#Calculations\n",
+ "Vp=((me*fe*d)/e) #voltage apllied between plates\n",
+ "\n",
+ "#Result\n",
+ "print(\"Voltage applied between plates:\")\n",
+ "print(\"Vp = %.2f * 10^-12 Kgm^2/s^2C\"%(Vp*10**12))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Voltage applied between plates:\n",
+ "Vp = 1.71 * 10^-12 Kgm^2/s^2C\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_5,pg 494"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# deflection sensitivity\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "l=1*10**-2 #axial length of plates\n",
+ "D=22*10**-2 #distance between centre of plate and screen \n",
+ "Vap=1.3*10**3 #acceleration mode voltage\n",
+ "d = 1*10**-3 #output in mm\n",
+ "\n",
+ "#Calculations\n",
+ "Sd=500*l*(D/(d*Vap)) #deflection senstivity\n",
+ "\n",
+ "#Result\n",
+ "print(\"deflection sensitivity:\")\n",
+ "print(\"Sd = %.2f mm/V\"%Sd) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "deflection sensitivity:\n",
+ "Sd = 0.85 mm/V\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_6,pg 494"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find deflection of electron\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vp=0.1*10**3 #deflection plate voltage\n",
+ "e=1.6*10**-19 #charge of electron\n",
+ "l=1*10**-2 #axial length of plates\n",
+ "del1=1*10**-3 #output in mm\n",
+ "m=9.1*10**-31 #mass of electron\n",
+ "D=0.22*10**-2 #distance between centre of plates and screen\n",
+ "t=0.1*10**-6 #time of flight\n",
+ "\n",
+ "#Calculations\n",
+ "del2=((Vp*e*l*D)/(del1*m))*(10**-10)\n",
+ "\n",
+ "#Result\n",
+ "print(\"deflection of electron beam from null pos:\")\n",
+ "print(\"del = %.f cm\"%(math.floor(del2)))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "deflection of electron beam from null pos:\n",
+ "del = 38 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_7,pg 494"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# cutoff frequency of filter\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R=10*10**5 #scope input impedance\n",
+ "C1=0.31*62*10**-12 #probe capacitance\n",
+ "C2=22*10**-12 #probe input impedance\n",
+ "\n",
+ "#Calculations\n",
+ "fcut = (1/(2*math.pi*R*(C1+C2)))\n",
+ "fcut = fcut/1000 # kHz \n",
+ "#Result\n",
+ "print(\"cutoff frequency:\")\n",
+ "print(\"fcut = %.1f kHz\"%(math.floor(fcut*10)/10))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "cutoff frequency:\n",
+ "fcut = 3.8 kHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_8,pg 494"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# phase difference\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "bplus=3.0 #ellipse parameter\n",
+ "bminus=-3.0 #ellipse parameter\n",
+ "aplus=1.5 #ellipse parameter\n",
+ "aminus=-1.5 #ellipse parameter\n",
+ "\n",
+ "\n",
+ "#case-1\n",
+ "y=6.0 #y-intercept\n",
+ "x=3.0 #x-intercept \n",
+ "phi1=math.asin(x/y) #phase difference\n",
+ "phi1=(180/math.pi)*phi1\n",
+ "\n",
+ "#case-2\n",
+ "phi2=180-phi1 #major axis in 2 and 4 quad.\n",
+ "\n",
+ "#case-3\n",
+ "phi3=math.asin(0) #y2=0\n",
+ " \n",
+ "#case-4\n",
+ "phi4=180-phi3 #y2=0 (major axis in 2 and 4 quad.)\n",
+ "\n",
+ "#Calculation\n",
+ "print(\"phi1 = %.1f\u00b0 \"%phi1)\n",
+ "print(\"phi2 = %.1f\u00b0 \"%phi2)\n",
+ "print(\"phi3 = %.1f\u00b0 or 360\u00b0 \"%phi3)\n",
+ "print(\"phi4 = %.1f\u00b0 \"%phi4)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "phi1 = 30.0\u00b0 \n",
+ "phi2 = 150.0\u00b0 \n",
+ "phi3 = 0.0\u00b0 or 360\u00b0 \n",
+ "phi4 = 180.0\u00b0 \n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_9,pg 495"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# rise time of pulse\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "B=25*10**6 #bandwidth of scope\n",
+ "\n",
+ "#Calculatoins\n",
+ "tr=(3.5/B) #rise time of scope\n",
+ "\n",
+ "#Result\n",
+ "print(\"Rise time of scope:\")\n",
+ "print(\"tr = %.2f micro-sec\"%(tr*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rise time of scope:\n",
+ "tr = 0.14 micro-sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_10,pg 495"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find speed of conversion\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Res=(1.0/2**8) #resolution\n",
+ "T=8.0*10**-6 #total time \n",
+ "n=256.0 #no. of conversions\n",
+ "\n",
+ "#Calculations\n",
+ "t=(T/n) #time req. by one conversion\n",
+ "S=(1.0/t) #speed of conversion\n",
+ "\n",
+ "#Result\n",
+ "print(\"speed of conversion:\")\n",
+ "print(\"S = %.1f MHz\\n\"%(S*10**-6))\n",
+ "#Answer is not matching with the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "speed of conversion:\n",
+ "S = 32.0 MHz\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_11,pg 495"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Find total collector resistance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "C=0.01*10**-6 #timing capacitor\n",
+ "T=10*10**-3 #time period\n",
+ "\n",
+ "#Calculations\n",
+ "Rt=T/(4*C) #total collector resistance\n",
+ "\n",
+ "#Result\n",
+ "print(\"Total collector resistance:\")\n",
+ "print(\"Rt = %.f k-ohm\"%(Rt/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Total collector resistance:\n",
+ "Rt = 250 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_12,pg 495"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# deflection plates voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "d1=1.03*10**-2 #separation of plates\n",
+ "theta=(6.0/5.0) #deflection of electron(1(deg.)12'=(6/5)deg.)\n",
+ "l=2.2*10**-2 #length of deflection plate\n",
+ "Vap=2.2*10**3 #accelerating potential\n",
+ "\n",
+ "#Calculations\n",
+ "x=math.tan((math.pi/180)*(6.0/5.0))\n",
+ "x = 0.019 # value of above expression should be this\n",
+ "Vp=(x/l)*d1*Vap*2\n",
+ "\n",
+ "#Result\n",
+ "print(\"Potential between plates:\")\n",
+ "print(\"Vp = %d V\"%Vp)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Potential between plates:\n",
+ "Vp = 39 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 52
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch6_1.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch6_1.ipynb new file mode 100755 index 00000000..20a99fec --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch6_1.ipynb @@ -0,0 +1,541 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 6 : Cathode Ray Oscilloscope"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_1,pg 169"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Time required for each conversion\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "n = 8.0 #8-bit resolution(conversion of 1 in 256)\n",
+ "Tr = 10.0*10**-6 #total trace time(256 conversions in 10*10^-6 s)\n",
+ "Nc = 256.0 #total conversions\n",
+ "\n",
+ "#Calculations\n",
+ "S = (Tr/Nc) #speed of ADC\n",
+ "\n",
+ "#Result\n",
+ "print(\"Time required for each conversion = %d ns\"%(S*10**9))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Time required for each conversion = 39 ns\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Example6_2,pg 178"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find frequency at horizontal plate\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fy=1.8*10**3 #frequency at vertical plates\n",
+ "Nv=2.0 #vertical tangencies\n",
+ "Nh=3.0 #horizontal tangencies\n",
+ "\n",
+ "#Calculations\n",
+ "fx=fy*(Nv/Nh) #frequency at horizontal plates\n",
+ "\n",
+ "#Result\n",
+ "print(\"frequency of other wave:\")\n",
+ "print(\"fx = %.1f kHz\"%(fx/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "frequency of other wave:\n",
+ "fx = 1.2 kHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_3,pg 178"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find length of vertical axis of ellipse\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "phi = math.pi*30/180 #conversion into radian\n",
+ "bplus = 3 #ellipse cutting +ve minor axis\n",
+ "bminus=-3 #ellipse cutting -ve minor axis\n",
+ "\n",
+ "#Calculations\n",
+ "theta = math.atan(2.0/1.0) #angle of major axis of ellipse(Vy/Vh=2:1)\n",
+ "y1=(bplus/math.sin(phi)) #length of vertical axis\n",
+ " \n",
+ "\n",
+ "#Result\n",
+ "print(\"length of vertical axis:\")\n",
+ "print(\"y1 = (+/-)%.2f cm\"%y1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "length of vertical axis:\n",
+ "y1 = (+/-)6.00 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_4,pg 493"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find voltage applied between plates\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "d=1*10**-3 #separation between plates\n",
+ "fe=300 #acceleration of electron\n",
+ "e=1.6*10**-19 #charge of 1 electron\n",
+ "me=9.1*10**-31 #mass of 1 electron\n",
+ "\n",
+ "#Calculations\n",
+ "Vp=((me*fe*d)/e) #voltage apllied between plates\n",
+ "\n",
+ "#Result\n",
+ "print(\"Voltage applied between plates:\")\n",
+ "print(\"Vp = %.2f * 10^-12 Kgm^2/s^2C\"%(Vp*10**12))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Voltage applied between plates:\n",
+ "Vp = 1.71 * 10^-12 Kgm^2/s^2C\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_5,pg 494"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# deflection sensitivity\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "l=1*10**-2 #axial length of plates\n",
+ "D=22*10**-2 #distance between centre of plate and screen \n",
+ "Vap=1.3*10**3 #acceleration mode voltage\n",
+ "d = 1*10**-3 #output in mm\n",
+ "\n",
+ "#Calculations\n",
+ "Sd=500*l*(D/(d*Vap)) #deflection senstivity\n",
+ "\n",
+ "#Result\n",
+ "print(\"deflection sensitivity:\")\n",
+ "print(\"Sd = %.2f mm/V\"%Sd) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "deflection sensitivity:\n",
+ "Sd = 0.85 mm/V\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_6,pg 494"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find deflection of electron\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vp=0.1*10**3 #deflection plate voltage\n",
+ "e=1.6*10**-19 #charge of electron\n",
+ "l=1*10**-2 #axial length of plates\n",
+ "del1=1*10**-3 #output in mm\n",
+ "m=9.1*10**-31 #mass of electron\n",
+ "D=0.22*10**-2 #distance between centre of plates and screen\n",
+ "t=0.1*10**-6 #time of flight\n",
+ "\n",
+ "#Calculations\n",
+ "del2=((Vp*e*l*D)/(del1*m))*(10**-10)\n",
+ "\n",
+ "#Result\n",
+ "print(\"deflection of electron beam from null pos:\")\n",
+ "print(\"del = %.f cm\"%(math.floor(del2)))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "deflection of electron beam from null pos:\n",
+ "del = 38 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_7,pg 494"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# cutoff frequency of filter\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R=10*10**5 #scope input impedance\n",
+ "C1=0.31*62*10**-12 #probe capacitance\n",
+ "C2=22*10**-12 #probe input impedance\n",
+ "\n",
+ "#Calculations\n",
+ "fcut = (1/(2*math.pi*R*(C1+C2)))\n",
+ "fcut = fcut/1000 # kHz \n",
+ "#Result\n",
+ "print(\"cutoff frequency:\")\n",
+ "print(\"fcut = %.1f kHz\"%(math.floor(fcut*10)/10))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "cutoff frequency:\n",
+ "fcut = 3.8 kHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_8,pg 494"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# phase difference\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "bplus=3.0 #ellipse parameter\n",
+ "bminus=-3.0 #ellipse parameter\n",
+ "aplus=1.5 #ellipse parameter\n",
+ "aminus=-1.5 #ellipse parameter\n",
+ "\n",
+ "\n",
+ "#case-1\n",
+ "y=6.0 #y-intercept\n",
+ "x=3.0 #x-intercept \n",
+ "phi1=math.asin(x/y) #phase difference\n",
+ "phi1=(180/math.pi)*phi1\n",
+ "\n",
+ "#case-2\n",
+ "phi2=180-phi1 #major axis in 2 and 4 quad.\n",
+ "\n",
+ "#case-3\n",
+ "phi3=math.asin(0) #y2=0\n",
+ " \n",
+ "#case-4\n",
+ "phi4=180-phi3 #y2=0 (major axis in 2 and 4 quad.)\n",
+ "\n",
+ "#Calculation\n",
+ "print(\"phi1 = %.1f\u00b0 \"%phi1)\n",
+ "print(\"phi2 = %.1f\u00b0 \"%phi2)\n",
+ "print(\"phi3 = %.1f\u00b0 or 360\u00b0 \"%phi3)\n",
+ "print(\"phi4 = %.1f\u00b0 \"%phi4)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "phi1 = 30.0\u00b0 \n",
+ "phi2 = 150.0\u00b0 \n",
+ "phi3 = 0.0\u00b0 or 360\u00b0 \n",
+ "phi4 = 180.0\u00b0 \n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_9,pg 495"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# rise time of pulse\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "B=25*10**6 #bandwidth of scope\n",
+ "\n",
+ "#Calculatoins\n",
+ "tr=(3.5/B) #rise time of scope\n",
+ "\n",
+ "#Result\n",
+ "print(\"Rise time of scope:\")\n",
+ "print(\"tr = %.2f micro-sec\"%(tr*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rise time of scope:\n",
+ "tr = 0.14 micro-sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_10,pg 495"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find speed of conversion\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Res=(1.0/2**8) #resolution\n",
+ "T=8.0*10**-6 #total time \n",
+ "n=256.0 #no. of conversions\n",
+ "\n",
+ "#Calculations\n",
+ "t=(T/n) #time req. by one conversion\n",
+ "S=(1.0/t) #speed of conversion\n",
+ "\n",
+ "#Result\n",
+ "print(\"speed of conversion:\")\n",
+ "print(\"S = %.1f MHz\\n\"%(S*10**-6))\n",
+ "#Answer is not matching with the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "speed of conversion:\n",
+ "S = 32.0 MHz\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_11,pg 495"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Find total collector resistance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "C=0.01*10**-6 #timing capacitor\n",
+ "T=10*10**-3 #time period\n",
+ "\n",
+ "#Calculations\n",
+ "Rt=T/(4*C) #total collector resistance\n",
+ "\n",
+ "#Result\n",
+ "print(\"Total collector resistance:\")\n",
+ "print(\"Rt = %.f k-ohm\"%(Rt/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Total collector resistance:\n",
+ "Rt = 250 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_12,pg 495"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# deflection plates voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "d1=1.03*10**-2 #separation of plates\n",
+ "theta=(6.0/5.0) #deflection of electron(1(deg.)12'=(6/5)deg.)\n",
+ "l=2.2*10**-2 #length of deflection plate\n",
+ "Vap=2.2*10**3 #accelerating potential\n",
+ "\n",
+ "#Calculations\n",
+ "x=math.tan((math.pi/180)*(6.0/5.0))\n",
+ "x = 0.019 # value of above expression should be this\n",
+ "Vp=(x/l)*d1*Vap*2\n",
+ "\n",
+ "#Result\n",
+ "print(\"Potential between plates:\")\n",
+ "print(\"Vp = %d V\"%Vp)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Potential between plates:\n",
+ "Vp = 39 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 52
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch6_2.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch6_2.ipynb new file mode 100755 index 00000000..20a99fec --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch6_2.ipynb @@ -0,0 +1,541 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 6 : Cathode Ray Oscilloscope"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_1,pg 169"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Time required for each conversion\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "n = 8.0 #8-bit resolution(conversion of 1 in 256)\n",
+ "Tr = 10.0*10**-6 #total trace time(256 conversions in 10*10^-6 s)\n",
+ "Nc = 256.0 #total conversions\n",
+ "\n",
+ "#Calculations\n",
+ "S = (Tr/Nc) #speed of ADC\n",
+ "\n",
+ "#Result\n",
+ "print(\"Time required for each conversion = %d ns\"%(S*10**9))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Time required for each conversion = 39 ns\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Example6_2,pg 178"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find frequency at horizontal plate\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fy=1.8*10**3 #frequency at vertical plates\n",
+ "Nv=2.0 #vertical tangencies\n",
+ "Nh=3.0 #horizontal tangencies\n",
+ "\n",
+ "#Calculations\n",
+ "fx=fy*(Nv/Nh) #frequency at horizontal plates\n",
+ "\n",
+ "#Result\n",
+ "print(\"frequency of other wave:\")\n",
+ "print(\"fx = %.1f kHz\"%(fx/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "frequency of other wave:\n",
+ "fx = 1.2 kHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_3,pg 178"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find length of vertical axis of ellipse\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "phi = math.pi*30/180 #conversion into radian\n",
+ "bplus = 3 #ellipse cutting +ve minor axis\n",
+ "bminus=-3 #ellipse cutting -ve minor axis\n",
+ "\n",
+ "#Calculations\n",
+ "theta = math.atan(2.0/1.0) #angle of major axis of ellipse(Vy/Vh=2:1)\n",
+ "y1=(bplus/math.sin(phi)) #length of vertical axis\n",
+ " \n",
+ "\n",
+ "#Result\n",
+ "print(\"length of vertical axis:\")\n",
+ "print(\"y1 = (+/-)%.2f cm\"%y1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "length of vertical axis:\n",
+ "y1 = (+/-)6.00 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_4,pg 493"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find voltage applied between plates\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "d=1*10**-3 #separation between plates\n",
+ "fe=300 #acceleration of electron\n",
+ "e=1.6*10**-19 #charge of 1 electron\n",
+ "me=9.1*10**-31 #mass of 1 electron\n",
+ "\n",
+ "#Calculations\n",
+ "Vp=((me*fe*d)/e) #voltage apllied between plates\n",
+ "\n",
+ "#Result\n",
+ "print(\"Voltage applied between plates:\")\n",
+ "print(\"Vp = %.2f * 10^-12 Kgm^2/s^2C\"%(Vp*10**12))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Voltage applied between plates:\n",
+ "Vp = 1.71 * 10^-12 Kgm^2/s^2C\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_5,pg 494"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# deflection sensitivity\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "l=1*10**-2 #axial length of plates\n",
+ "D=22*10**-2 #distance between centre of plate and screen \n",
+ "Vap=1.3*10**3 #acceleration mode voltage\n",
+ "d = 1*10**-3 #output in mm\n",
+ "\n",
+ "#Calculations\n",
+ "Sd=500*l*(D/(d*Vap)) #deflection senstivity\n",
+ "\n",
+ "#Result\n",
+ "print(\"deflection sensitivity:\")\n",
+ "print(\"Sd = %.2f mm/V\"%Sd) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "deflection sensitivity:\n",
+ "Sd = 0.85 mm/V\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_6,pg 494"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find deflection of electron\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vp=0.1*10**3 #deflection plate voltage\n",
+ "e=1.6*10**-19 #charge of electron\n",
+ "l=1*10**-2 #axial length of plates\n",
+ "del1=1*10**-3 #output in mm\n",
+ "m=9.1*10**-31 #mass of electron\n",
+ "D=0.22*10**-2 #distance between centre of plates and screen\n",
+ "t=0.1*10**-6 #time of flight\n",
+ "\n",
+ "#Calculations\n",
+ "del2=((Vp*e*l*D)/(del1*m))*(10**-10)\n",
+ "\n",
+ "#Result\n",
+ "print(\"deflection of electron beam from null pos:\")\n",
+ "print(\"del = %.f cm\"%(math.floor(del2)))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "deflection of electron beam from null pos:\n",
+ "del = 38 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_7,pg 494"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# cutoff frequency of filter\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R=10*10**5 #scope input impedance\n",
+ "C1=0.31*62*10**-12 #probe capacitance\n",
+ "C2=22*10**-12 #probe input impedance\n",
+ "\n",
+ "#Calculations\n",
+ "fcut = (1/(2*math.pi*R*(C1+C2)))\n",
+ "fcut = fcut/1000 # kHz \n",
+ "#Result\n",
+ "print(\"cutoff frequency:\")\n",
+ "print(\"fcut = %.1f kHz\"%(math.floor(fcut*10)/10))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "cutoff frequency:\n",
+ "fcut = 3.8 kHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_8,pg 494"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# phase difference\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "bplus=3.0 #ellipse parameter\n",
+ "bminus=-3.0 #ellipse parameter\n",
+ "aplus=1.5 #ellipse parameter\n",
+ "aminus=-1.5 #ellipse parameter\n",
+ "\n",
+ "\n",
+ "#case-1\n",
+ "y=6.0 #y-intercept\n",
+ "x=3.0 #x-intercept \n",
+ "phi1=math.asin(x/y) #phase difference\n",
+ "phi1=(180/math.pi)*phi1\n",
+ "\n",
+ "#case-2\n",
+ "phi2=180-phi1 #major axis in 2 and 4 quad.\n",
+ "\n",
+ "#case-3\n",
+ "phi3=math.asin(0) #y2=0\n",
+ " \n",
+ "#case-4\n",
+ "phi4=180-phi3 #y2=0 (major axis in 2 and 4 quad.)\n",
+ "\n",
+ "#Calculation\n",
+ "print(\"phi1 = %.1f\u00b0 \"%phi1)\n",
+ "print(\"phi2 = %.1f\u00b0 \"%phi2)\n",
+ "print(\"phi3 = %.1f\u00b0 or 360\u00b0 \"%phi3)\n",
+ "print(\"phi4 = %.1f\u00b0 \"%phi4)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "phi1 = 30.0\u00b0 \n",
+ "phi2 = 150.0\u00b0 \n",
+ "phi3 = 0.0\u00b0 or 360\u00b0 \n",
+ "phi4 = 180.0\u00b0 \n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_9,pg 495"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# rise time of pulse\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "B=25*10**6 #bandwidth of scope\n",
+ "\n",
+ "#Calculatoins\n",
+ "tr=(3.5/B) #rise time of scope\n",
+ "\n",
+ "#Result\n",
+ "print(\"Rise time of scope:\")\n",
+ "print(\"tr = %.2f micro-sec\"%(tr*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rise time of scope:\n",
+ "tr = 0.14 micro-sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_10,pg 495"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find speed of conversion\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Res=(1.0/2**8) #resolution\n",
+ "T=8.0*10**-6 #total time \n",
+ "n=256.0 #no. of conversions\n",
+ "\n",
+ "#Calculations\n",
+ "t=(T/n) #time req. by one conversion\n",
+ "S=(1.0/t) #speed of conversion\n",
+ "\n",
+ "#Result\n",
+ "print(\"speed of conversion:\")\n",
+ "print(\"S = %.1f MHz\\n\"%(S*10**-6))\n",
+ "#Answer is not matching with the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "speed of conversion:\n",
+ "S = 32.0 MHz\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_11,pg 495"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Find total collector resistance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "C=0.01*10**-6 #timing capacitor\n",
+ "T=10*10**-3 #time period\n",
+ "\n",
+ "#Calculations\n",
+ "Rt=T/(4*C) #total collector resistance\n",
+ "\n",
+ "#Result\n",
+ "print(\"Total collector resistance:\")\n",
+ "print(\"Rt = %.f k-ohm\"%(Rt/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Total collector resistance:\n",
+ "Rt = 250 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6_12,pg 495"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# deflection plates voltage\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "d1=1.03*10**-2 #separation of plates\n",
+ "theta=(6.0/5.0) #deflection of electron(1(deg.)12'=(6/5)deg.)\n",
+ "l=2.2*10**-2 #length of deflection plate\n",
+ "Vap=2.2*10**3 #accelerating potential\n",
+ "\n",
+ "#Calculations\n",
+ "x=math.tan((math.pi/180)*(6.0/5.0))\n",
+ "x = 0.019 # value of above expression should be this\n",
+ "Vp=(x/l)*d1*Vap*2\n",
+ "\n",
+ "#Result\n",
+ "print(\"Potential between plates:\")\n",
+ "print(\"Vp = %d V\"%Vp)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Potential between plates:\n",
+ "Vp = 39 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 52
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch7.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch7.ipynb new file mode 100755 index 00000000..55ff6db4 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch7.ipynb @@ -0,0 +1,435 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 7: Phase Frequency and Time"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_1,pg 496"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find pulse width\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "delt=1*10**-3 #pulse width\n",
+ "#w=2wo\n",
+ "#delt at w=2wo\n",
+ "\n",
+ "#Calculations\n",
+ "delT=(delt/2.0) #changed in pulse width\n",
+ "\n",
+ "#Result\n",
+ "print(\"pulse width:\")\n",
+ "print(\"delT = %.1f ms\"%(delT*10**3))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "pulse width:\n",
+ "delT = 0.5 ms\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_2,pg 496"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# detector senstivity\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "\n",
+ "#senstivity of phase detection\n",
+ "#Sphi=(Vo/sin(B))=(Vo/B)=(+/-)0.5Vmax, B is phase displacement\n",
+ "Vmax=1.0 #amplitude of cosine waves\n",
+ "\n",
+ "#Calculations\n",
+ "Sphi=(1.0/2)*Vmax\n",
+ "\n",
+ "#Result\n",
+ "print(\"senstivity of phase detection:\")\n",
+ "print(\"Sphi = %.1f V/rad\"%Sphi)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "senstivity of phase detection:\n",
+ "Sphi = 0.5 V/rad\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_3,pg 496"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# phase measured\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vp=1.3 #pulse height\n",
+ "delt=0.31*10**-3 #pulse width\n",
+ "T=1*10**-3 #pulse repetion rate\n",
+ "\n",
+ "#Calculations\n",
+ "Vphi=Vp*(delt/T) #phase deviation\n",
+ "phi=2*math.pi*(Vphi/Vp) #phase\n",
+ "\n",
+ "#Result\n",
+ "print(\"phase measured:\")\n",
+ "print(\"phi = %.4f rad\"%phi)\n",
+ "#Answer is wrong in the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "phase measured:\n",
+ "phi = 1.9478 rad\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_4,pg 497"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# measured phase difference\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "delt=0.13*10**-3 #time delay\n",
+ "T=1.3*10**-3 #time period\n",
+ "\n",
+ "#Calculations\n",
+ "n=(1.0/3.0)*(1+(delt/T)) #order of phase meter\n",
+ "delphi=(n-(1.0/3))*1080 #measured phase difference\n",
+ "\n",
+ "#Result\n",
+ "print(\"measured phase difference:\")\n",
+ "print(\"delphi = %.f\u00b0\"%delphi)\n",
+ "#Answer slightly different than the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "measured phase difference:\n",
+ "delphi = 36\u00b0\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_5,pg 497"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find phase difference\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "n=8.0 #8-bit counter\n",
+ "N2=64.0 #output digital count\n",
+ "\n",
+ "#Calculations\n",
+ "theta=math.pi*(N2/(2**n-1))\n",
+ "\n",
+ "#Result\n",
+ "print(\"measured phase difference:\")\n",
+ "print(\"theta = %.3f radian\"%theta)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "measured phase difference:\n",
+ "theta = 0.788 radian\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_6,pg 497"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# states for stages required\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#since the no. is more than 9, the two-stage counting is required. the states of the stages are\n",
+ "print(\"D C B A decimal equivalent\")\n",
+ "a1=\"0 0 0 1 1\"\n",
+ "a5=\"0 1 0 1 5\"\n",
+ "\n",
+ "#Result\n",
+ "print a1 \n",
+ "print a5"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "D C B A decimal equivalent\n",
+ "0 0 0 1 1\n",
+ "0 1 0 1 5\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_7,pg 498"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find time base division\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fd=10.0*10**6 #frequency meter input\n",
+ "fc=10.0*10**3 #counter clock\n",
+ "fi=100.0*10**6 #actual input frequency\n",
+ "\n",
+ "#Calculations\n",
+ "k=fc*(fd/fi) #division time base\n",
+ "\n",
+ "#Result\n",
+ "print(\"division time base:\")\n",
+ "print(\"k = %.f\"%k)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "division time base:\n",
+ "k = 1000\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_8,pg 498"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# frequency of sinusoid\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "V2=0.130 #output-1\n",
+ "V1=0.103 #output-2\n",
+ "Vx=0.4 #peak amplitude\n",
+ "delt=0.1*10**-3 #time delay\n",
+ "\n",
+ "#Calculations\n",
+ "f1=(1.0/(2*math.pi*delt))*(math.asin(V2/Vx)-math.asin(V1/Vx))\n",
+ "\n",
+ "#Result\n",
+ "print(\"frequency of sinusoid:\")\n",
+ "print(\"f1 = %.0f Hz\"%(math.ceil(f1)))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "frequency of sinusoid:\n",
+ "f1 = 113 Hz\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_9,pg 498"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# count of counter(refer fig. 7.30(a),(b),(c))\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#N=(2*fc/fs^2)*fi\n",
+ "fs=10*10**2 #sampler frequency\n",
+ "fc=10*10**3 #counter clock\n",
+ "\n",
+ "#Calculations\n",
+ "M=(fs**2)/(2*fc) #multiplication factor\n",
+ "fi=113.0 #input frequency\n",
+ "N=(1.0/M)*fi #count of counter\n",
+ "\n",
+ "print(\"count of counter:\")\n",
+ "print(\"N = %.2f \"%N)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "count of counter:\n",
+ "N = 2.26 \n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_10,pg 498"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find time between events \n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "n=10.0*10**2 #scale factor=(1/n)\n",
+ "fc=10.0*10**5 #clock frequency\n",
+ "N=10.0 #count\n",
+ "\n",
+ "#Calculations\n",
+ "Tp=(n/fc)*N #time between events\n",
+ "\n",
+ "#Result\n",
+ "print(\"time between events:\")\n",
+ "print(\"Tp = %.f ms\"%(Tp*1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "time between events:\n",
+ "Tp = 10 ms\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch7_1.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch7_1.ipynb new file mode 100755 index 00000000..55ff6db4 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch7_1.ipynb @@ -0,0 +1,435 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 7: Phase Frequency and Time"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_1,pg 496"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find pulse width\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "delt=1*10**-3 #pulse width\n",
+ "#w=2wo\n",
+ "#delt at w=2wo\n",
+ "\n",
+ "#Calculations\n",
+ "delT=(delt/2.0) #changed in pulse width\n",
+ "\n",
+ "#Result\n",
+ "print(\"pulse width:\")\n",
+ "print(\"delT = %.1f ms\"%(delT*10**3))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "pulse width:\n",
+ "delT = 0.5 ms\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_2,pg 496"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# detector senstivity\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "\n",
+ "#senstivity of phase detection\n",
+ "#Sphi=(Vo/sin(B))=(Vo/B)=(+/-)0.5Vmax, B is phase displacement\n",
+ "Vmax=1.0 #amplitude of cosine waves\n",
+ "\n",
+ "#Calculations\n",
+ "Sphi=(1.0/2)*Vmax\n",
+ "\n",
+ "#Result\n",
+ "print(\"senstivity of phase detection:\")\n",
+ "print(\"Sphi = %.1f V/rad\"%Sphi)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "senstivity of phase detection:\n",
+ "Sphi = 0.5 V/rad\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_3,pg 496"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# phase measured\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vp=1.3 #pulse height\n",
+ "delt=0.31*10**-3 #pulse width\n",
+ "T=1*10**-3 #pulse repetion rate\n",
+ "\n",
+ "#Calculations\n",
+ "Vphi=Vp*(delt/T) #phase deviation\n",
+ "phi=2*math.pi*(Vphi/Vp) #phase\n",
+ "\n",
+ "#Result\n",
+ "print(\"phase measured:\")\n",
+ "print(\"phi = %.4f rad\"%phi)\n",
+ "#Answer is wrong in the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "phase measured:\n",
+ "phi = 1.9478 rad\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_4,pg 497"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# measured phase difference\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "delt=0.13*10**-3 #time delay\n",
+ "T=1.3*10**-3 #time period\n",
+ "\n",
+ "#Calculations\n",
+ "n=(1.0/3.0)*(1+(delt/T)) #order of phase meter\n",
+ "delphi=(n-(1.0/3))*1080 #measured phase difference\n",
+ "\n",
+ "#Result\n",
+ "print(\"measured phase difference:\")\n",
+ "print(\"delphi = %.f\u00b0\"%delphi)\n",
+ "#Answer slightly different than the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "measured phase difference:\n",
+ "delphi = 36\u00b0\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_5,pg 497"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find phase difference\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "n=8.0 #8-bit counter\n",
+ "N2=64.0 #output digital count\n",
+ "\n",
+ "#Calculations\n",
+ "theta=math.pi*(N2/(2**n-1))\n",
+ "\n",
+ "#Result\n",
+ "print(\"measured phase difference:\")\n",
+ "print(\"theta = %.3f radian\"%theta)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "measured phase difference:\n",
+ "theta = 0.788 radian\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_6,pg 497"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# states for stages required\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#since the no. is more than 9, the two-stage counting is required. the states of the stages are\n",
+ "print(\"D C B A decimal equivalent\")\n",
+ "a1=\"0 0 0 1 1\"\n",
+ "a5=\"0 1 0 1 5\"\n",
+ "\n",
+ "#Result\n",
+ "print a1 \n",
+ "print a5"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "D C B A decimal equivalent\n",
+ "0 0 0 1 1\n",
+ "0 1 0 1 5\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_7,pg 498"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find time base division\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fd=10.0*10**6 #frequency meter input\n",
+ "fc=10.0*10**3 #counter clock\n",
+ "fi=100.0*10**6 #actual input frequency\n",
+ "\n",
+ "#Calculations\n",
+ "k=fc*(fd/fi) #division time base\n",
+ "\n",
+ "#Result\n",
+ "print(\"division time base:\")\n",
+ "print(\"k = %.f\"%k)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "division time base:\n",
+ "k = 1000\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_8,pg 498"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# frequency of sinusoid\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "V2=0.130 #output-1\n",
+ "V1=0.103 #output-2\n",
+ "Vx=0.4 #peak amplitude\n",
+ "delt=0.1*10**-3 #time delay\n",
+ "\n",
+ "#Calculations\n",
+ "f1=(1.0/(2*math.pi*delt))*(math.asin(V2/Vx)-math.asin(V1/Vx))\n",
+ "\n",
+ "#Result\n",
+ "print(\"frequency of sinusoid:\")\n",
+ "print(\"f1 = %.0f Hz\"%(math.ceil(f1)))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "frequency of sinusoid:\n",
+ "f1 = 113 Hz\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_9,pg 498"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# count of counter(refer fig. 7.30(a),(b),(c))\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#N=(2*fc/fs^2)*fi\n",
+ "fs=10*10**2 #sampler frequency\n",
+ "fc=10*10**3 #counter clock\n",
+ "\n",
+ "#Calculations\n",
+ "M=(fs**2)/(2*fc) #multiplication factor\n",
+ "fi=113.0 #input frequency\n",
+ "N=(1.0/M)*fi #count of counter\n",
+ "\n",
+ "print(\"count of counter:\")\n",
+ "print(\"N = %.2f \"%N)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "count of counter:\n",
+ "N = 2.26 \n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_10,pg 498"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find time between events \n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "n=10.0*10**2 #scale factor=(1/n)\n",
+ "fc=10.0*10**5 #clock frequency\n",
+ "N=10.0 #count\n",
+ "\n",
+ "#Calculations\n",
+ "Tp=(n/fc)*N #time between events\n",
+ "\n",
+ "#Result\n",
+ "print(\"time between events:\")\n",
+ "print(\"Tp = %.f ms\"%(Tp*1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "time between events:\n",
+ "Tp = 10 ms\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch7_2.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch7_2.ipynb new file mode 100755 index 00000000..55ff6db4 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch7_2.ipynb @@ -0,0 +1,435 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 7: Phase Frequency and Time"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_1,pg 496"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find pulse width\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "delt=1*10**-3 #pulse width\n",
+ "#w=2wo\n",
+ "#delt at w=2wo\n",
+ "\n",
+ "#Calculations\n",
+ "delT=(delt/2.0) #changed in pulse width\n",
+ "\n",
+ "#Result\n",
+ "print(\"pulse width:\")\n",
+ "print(\"delT = %.1f ms\"%(delT*10**3))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "pulse width:\n",
+ "delT = 0.5 ms\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_2,pg 496"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# detector senstivity\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "\n",
+ "#senstivity of phase detection\n",
+ "#Sphi=(Vo/sin(B))=(Vo/B)=(+/-)0.5Vmax, B is phase displacement\n",
+ "Vmax=1.0 #amplitude of cosine waves\n",
+ "\n",
+ "#Calculations\n",
+ "Sphi=(1.0/2)*Vmax\n",
+ "\n",
+ "#Result\n",
+ "print(\"senstivity of phase detection:\")\n",
+ "print(\"Sphi = %.1f V/rad\"%Sphi)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "senstivity of phase detection:\n",
+ "Sphi = 0.5 V/rad\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_3,pg 496"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# phase measured\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vp=1.3 #pulse height\n",
+ "delt=0.31*10**-3 #pulse width\n",
+ "T=1*10**-3 #pulse repetion rate\n",
+ "\n",
+ "#Calculations\n",
+ "Vphi=Vp*(delt/T) #phase deviation\n",
+ "phi=2*math.pi*(Vphi/Vp) #phase\n",
+ "\n",
+ "#Result\n",
+ "print(\"phase measured:\")\n",
+ "print(\"phi = %.4f rad\"%phi)\n",
+ "#Answer is wrong in the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "phase measured:\n",
+ "phi = 1.9478 rad\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_4,pg 497"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# measured phase difference\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "delt=0.13*10**-3 #time delay\n",
+ "T=1.3*10**-3 #time period\n",
+ "\n",
+ "#Calculations\n",
+ "n=(1.0/3.0)*(1+(delt/T)) #order of phase meter\n",
+ "delphi=(n-(1.0/3))*1080 #measured phase difference\n",
+ "\n",
+ "#Result\n",
+ "print(\"measured phase difference:\")\n",
+ "print(\"delphi = %.f\u00b0\"%delphi)\n",
+ "#Answer slightly different than the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "measured phase difference:\n",
+ "delphi = 36\u00b0\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_5,pg 497"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find phase difference\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "n=8.0 #8-bit counter\n",
+ "N2=64.0 #output digital count\n",
+ "\n",
+ "#Calculations\n",
+ "theta=math.pi*(N2/(2**n-1))\n",
+ "\n",
+ "#Result\n",
+ "print(\"measured phase difference:\")\n",
+ "print(\"theta = %.3f radian\"%theta)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "measured phase difference:\n",
+ "theta = 0.788 radian\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_6,pg 497"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# states for stages required\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#since the no. is more than 9, the two-stage counting is required. the states of the stages are\n",
+ "print(\"D C B A decimal equivalent\")\n",
+ "a1=\"0 0 0 1 1\"\n",
+ "a5=\"0 1 0 1 5\"\n",
+ "\n",
+ "#Result\n",
+ "print a1 \n",
+ "print a5"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "D C B A decimal equivalent\n",
+ "0 0 0 1 1\n",
+ "0 1 0 1 5\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_7,pg 498"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find time base division\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fd=10.0*10**6 #frequency meter input\n",
+ "fc=10.0*10**3 #counter clock\n",
+ "fi=100.0*10**6 #actual input frequency\n",
+ "\n",
+ "#Calculations\n",
+ "k=fc*(fd/fi) #division time base\n",
+ "\n",
+ "#Result\n",
+ "print(\"division time base:\")\n",
+ "print(\"k = %.f\"%k)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "division time base:\n",
+ "k = 1000\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_8,pg 498"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# frequency of sinusoid\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "V2=0.130 #output-1\n",
+ "V1=0.103 #output-2\n",
+ "Vx=0.4 #peak amplitude\n",
+ "delt=0.1*10**-3 #time delay\n",
+ "\n",
+ "#Calculations\n",
+ "f1=(1.0/(2*math.pi*delt))*(math.asin(V2/Vx)-math.asin(V1/Vx))\n",
+ "\n",
+ "#Result\n",
+ "print(\"frequency of sinusoid:\")\n",
+ "print(\"f1 = %.0f Hz\"%(math.ceil(f1)))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "frequency of sinusoid:\n",
+ "f1 = 113 Hz\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_9,pg 498"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# count of counter(refer fig. 7.30(a),(b),(c))\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#N=(2*fc/fs^2)*fi\n",
+ "fs=10*10**2 #sampler frequency\n",
+ "fc=10*10**3 #counter clock\n",
+ "\n",
+ "#Calculations\n",
+ "M=(fs**2)/(2*fc) #multiplication factor\n",
+ "fi=113.0 #input frequency\n",
+ "N=(1.0/M)*fi #count of counter\n",
+ "\n",
+ "print(\"count of counter:\")\n",
+ "print(\"N = %.2f \"%N)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "count of counter:\n",
+ "N = 2.26 \n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7_10,pg 498"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find time between events \n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "n=10.0*10**2 #scale factor=(1/n)\n",
+ "fc=10.0*10**5 #clock frequency\n",
+ "N=10.0 #count\n",
+ "\n",
+ "#Calculations\n",
+ "Tp=(n/fc)*N #time between events\n",
+ "\n",
+ "#Result\n",
+ "print(\"time between events:\")\n",
+ "print(\"Tp = %.f ms\"%(Tp*1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "time between events:\n",
+ "Tp = 10 ms\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch8.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch8.ipynb new file mode 100755 index 00000000..a772bd9b --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch8.ipynb @@ -0,0 +1,561 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 8 : Q factor Power and Power Factor"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_1,pg 234"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Q factor of coil\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fr= 400.0*10**3 #resonance frequency\n",
+ "C = 400.0*10**-12 #tuned capacitance\n",
+ "R = 10.0 #resistance of coil\n",
+ "n = 40.0 #Cp=nC\n",
+ "\n",
+ "#Calculations\n",
+ "Cp=n*(100.0/400.0)*10**-12 \n",
+ "L=(1.0/(4*(math.pi**2)*(fr**2)*(C+Cp)))\n",
+ "Q=2*math.pi*fr*(L/R)\n",
+ "\n",
+ "#Result\n",
+ "print(\"Inductance:\\nL = %f mH\"%(L*1000))\n",
+ "print(\"Observed Q-factor:\")\n",
+ "print(\"Q = %.2f \"%Q)\n",
+ "# Aanswer do not match with the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Inductance:\n",
+ "L = 0.386133 mH\n",
+ "Observed Q-factor:\n",
+ "Q = 97.05 \n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_2,pg 240"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# truncation error\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fs=50*10**3 #sampling rate\n",
+ "delt=2.0 #summation interval\n",
+ "f=50.0 #signal frequency\n",
+ "\n",
+ "#Calculations\n",
+ "n=(fs/delt) #value of samples for 2s\n",
+ "maxer1=100.0/(2*n) #max error for synchronous case\n",
+ "maxer2=(100.0/(2*fs*delt*math.sin((2*math.pi*f)/fs)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"max error for synchronous case:\")\n",
+ "print(\"maxer1 = %.3f%% \\n\"%maxer1)\n",
+ "print(\"max error for asynchronous case:\")\n",
+ "print(\"maxer2 = %.2f%% \"%maxer2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "max error for synchronous case:\n",
+ "maxer1 = 0.002% \n",
+ "\n",
+ "max error for asynchronous case:\n",
+ "maxer2 = 0.08% \n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_3,pg 258"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find ratio errror and phase angle\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#assume no iron loss and magnetizing current=1% of 10A, i.e 0.01A\n",
+ "Xs=1.884 #reactance of secondary\n",
+ "Rs=0.5 #resistance of secondary\n",
+ "Xm=2.0 #reactance of meter\n",
+ "Rm=0.4 #reactance of meter\n",
+ "Im=0.01 #magnetizing current\n",
+ "n2=10\n",
+ "n1=1\n",
+ "\n",
+ "#Calculations\n",
+ "B=math.atan((Xs+Xm)/(Rs+Rm))\n",
+ "#nominal ratio (n2/n1)=10/1\n",
+ "R=n2+((Im*math.sin(B))/n1) #actual impedance\n",
+ "R1=0.0097 #practical impedance\n",
+ "perer=(R1/R)*100 #percentage error\n",
+ "theta=((Im*math.cos(B))/n2)\n",
+ "\n",
+ "#Result\n",
+ "print(\"percentage error = %.3f%% \\n\"%perer)\n",
+ "print(\"phase angle:\")\n",
+ "print(\"theta = %.5f rad\"%(math.floor(theta*10**5)/10**5))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "percentage error = 0.097% \n",
+ "\n",
+ "phase angle:\n",
+ "theta = 0.00022 rad\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_4,pg 499"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# inductor Q factor and resistance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vc=100.0 #voltage across capacitor\n",
+ "Vi=12.0 #input voltage\n",
+ "f=100.0 #frequency of operation\n",
+ "Vl=100.0 #Vc=Vl at resonance\n",
+ "Ir=5.0 #current at resonance\n",
+ "\n",
+ "#Calculations\n",
+ "Q=(Vc/Vi) #Q-factor\n",
+ "Xl=(Vl/Ir) #inductive reactance\n",
+ "L=(Xl/(2*math.pi*f)) #inductance\n",
+ "Rl=(Xl/Q) #resistance\n",
+ "\n",
+ "#Result\n",
+ "print(\"Inductance of coil:\")\n",
+ "print(\"L = %.1f mH\\n\"%(L*1000))\n",
+ "print(\"Q-factor:\")\n",
+ "print(\"Q = %.2f\\n\"%Q)\n",
+ "print(\"Resistance of coil:\")\n",
+ "print(\"Rl = %.1f ohm\"%Rl)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Inductance of coil:\n",
+ "L = 31.8 mH\n",
+ "\n",
+ "Q-factor:\n",
+ "Q = 8.33\n",
+ "\n",
+ "Resistance of coil:\n",
+ "Rl = 2.4 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_5,pg 499"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# actual Q factor and resistance\n",
+ "\n",
+ "import math\n",
+ "# Variable declaration\n",
+ "#when switch is open\n",
+ "C1=0.011*10**-6 #capacitance-1\n",
+ "Q1=10.0 #Q-factor-1\n",
+ "#when switch is closed\n",
+ "C2=0.022*10**-6 #capacitance-2\n",
+ "Q2=100.0 #Q-factor-2\n",
+ "\n",
+ "#Calculations\n",
+ "Qac=((Q1*Q2)/(Q1-Q2))*((C1-C2)/C1) #actual Q-factor\n",
+ "Rp=((Q1*Q2)/(Q2-Q1))*(1/(2*math.pi*C2)) #parallel resistance\n",
+ "\n",
+ "#Result\n",
+ "print(\"actual Q-factor:\")\n",
+ "print(\"Qac = %.2f \\n\"%Qac)\n",
+ "print(\"parallel resistance:\")\n",
+ "print(\"Rp = %.f M-ohm\"%(Rp/10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "actual Q-factor:\n",
+ "Qac = 11.11 \n",
+ "\n",
+ "parallel resistance:\n",
+ "Rp = 80 M-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_6,pg 499"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find Q factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Cr=0.01*10**-6 #capacitance at resonance\n",
+ "Cu=0.014*10**-6 #capacitance at upper half\n",
+ "Cl=0.008*10**-6 #capacitance at lower half\n",
+ "\n",
+ "#Calculations\n",
+ "Qac=((2*Cr)/(Cu-Cl)) #actual Q-factor\n",
+ "\n",
+ "#Result\n",
+ "print(\"actual Q-factor:\")\n",
+ "print(\"Qac = %.2f \"%Qac)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "actual Q-factor:\n",
+ "Qac = 3.33 \n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_7,pg 499"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find lag\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "V=10.0 #v=10sin6280t\n",
+ "I=1.0 #current peak\n",
+ "P=3.1 #active power\n",
+ "\n",
+ "#Calculations\n",
+ "phi=math.acos((P*2)/V) #phase in radian\n",
+ "w=6280.0 #v=10sin6280t\n",
+ "lag=(phi/w) #lag\n",
+ "\n",
+ "#Result\n",
+ "print(\"lag = %.2f ms\"%(lag*10**3))\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "lag = 0.14 ms\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_8,pg 500"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find truncation error\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "V=4.0 #peak voltage\n",
+ "I=0.4 #peak current\n",
+ "f=1*10**3 #operating frequency\n",
+ "fs=40*10**3 #sampling rate\n",
+ "delt=2.2 #time interval\n",
+ "\n",
+ "#Calculations\n",
+ "phi=((2*math.pi*f)/fs) #phase \n",
+ "Et=(V*I*phi)/(4*math.pi*f*delt*math.sin(phi))\n",
+ "\n",
+ "#Result\n",
+ "print(\"truncation error:\")\n",
+ "print(\"Et = %.1f * 10^-6 \"%(Et*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "truncation error:\n",
+ "Et = 58.1 * 10^-6 \n"
+ ]
+ }
+ ],
+ "prompt_number": 36
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_9,pg 500"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find frequency of PF meter\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "ar=1.0 #gain of rectifier\n",
+ "nc=40.0 #turns ratio (1:40)\n",
+ "Vm=4.0 #peak load voltage\n",
+ "PF=0.85 #power factor\n",
+ "\n",
+ "#Calculations\n",
+ "f=(1/math.pi)*ar*Vm*nc*PF #frequency\n",
+ "\n",
+ "#Result\n",
+ "print(\"frequency of digital power meter:\")\n",
+ "print(\"f = %.1f Hz\"%f)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "frequency of digital power meter:\n",
+ "f = 43.3 Hz\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_10,pg 500"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# calculate ratio error and phase angle\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Rp=94.0 #primary resistance\n",
+ "Xp=64.3 #primary reactance\n",
+ "Rs=0.85*10**2 #secondary resistance\n",
+ "Im=31*10**-3 #magnetizing current\n",
+ "PF=0.4 #power factor\n",
+ "n=10.0 #PT ratio\n",
+ "Is=1.0 #load current\n",
+ "Vs=110.0 #n=(Vp/Vs)\n",
+ "\n",
+ "#Calculations\n",
+ "B=math.acos(PF)\n",
+ "beta = math.floor(math.sin(B)*10)/10\n",
+ "R=Rp+Rs #total resistance\n",
+ "nerr=n+((((Is/n)*((R*PF)+(Xp*beta)))+Im*Xp)/Vs)\n",
+ "theta=((PF*(Xp/n))-(beta*(R/n))-(Im*Rp))/(Vs*n)\n",
+ "\n",
+ "#Result\n",
+ "print(\"ratio error:\")\n",
+ "print(\"nerr = %.3f\\n\"%nerr)\n",
+ "print(\"phase angle:\")\n",
+ "print(\"theta = %.3f\"%theta)\n",
+ "#Answer for theta do not match with the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "ratio error:\n",
+ "nerr = 10.136\n",
+ "\n",
+ "phase angle:\n",
+ "theta = -0.015\n"
+ ]
+ }
+ ],
+ "prompt_number": 52
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_11,pg 500"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# calculate ratio error and phase angle\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "n=20.0 #(Vs/Is)\n",
+ "Is=5.0 #n=(Vs/Is)\n",
+ "Vs=100.0 #n=(Vs/Is)\n",
+ "N=0.25 #resistance to reactance ratio\n",
+ "Bur=15.0 #burden of CT=15VA (rating)\n",
+ "IL=0.13 #iron loss\n",
+ "Im=1.3 #magnetizing current\n",
+ "\n",
+ "#Calculations\n",
+ "V=(Bur/Is) #voltage rating\n",
+ "B=math.atan(N) #cos(B)-> power factor\n",
+ "#B=B*(180/math.pi) #conversion into degree\n",
+ "I=(Bur/Vs) #current rating\n",
+ "I1=(IL/I)\n",
+ "Rac=0.23 #actual value\n",
+ "R=n+((I1*math.cos(B)+Im*math.sin(B))/Is)\n",
+ "theta=((Im*math.cos(B)-I1*math.sin(B))/Vs)\n",
+ "nerr=-(Rac/R)*100 #ratio error\n",
+ "\n",
+ "# Result\n",
+ "print(\"ratio error:\")\n",
+ "print(\"nerr = %.3f%%\\n \"%nerr)\n",
+ "print(\"phase angle \\n\")\n",
+ "print(\"theta = %.4f\u00b0 \"%theta)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "ratio error:\n",
+ "nerr = -1.137%\n",
+ " \n",
+ "phase angle \n",
+ "\n",
+ "theta = 0.0105\u00b0 \n"
+ ]
+ }
+ ],
+ "prompt_number": 56
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch8_1.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch8_1.ipynb new file mode 100755 index 00000000..a772bd9b --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch8_1.ipynb @@ -0,0 +1,561 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 8 : Q factor Power and Power Factor"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_1,pg 234"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Q factor of coil\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fr= 400.0*10**3 #resonance frequency\n",
+ "C = 400.0*10**-12 #tuned capacitance\n",
+ "R = 10.0 #resistance of coil\n",
+ "n = 40.0 #Cp=nC\n",
+ "\n",
+ "#Calculations\n",
+ "Cp=n*(100.0/400.0)*10**-12 \n",
+ "L=(1.0/(4*(math.pi**2)*(fr**2)*(C+Cp)))\n",
+ "Q=2*math.pi*fr*(L/R)\n",
+ "\n",
+ "#Result\n",
+ "print(\"Inductance:\\nL = %f mH\"%(L*1000))\n",
+ "print(\"Observed Q-factor:\")\n",
+ "print(\"Q = %.2f \"%Q)\n",
+ "# Aanswer do not match with the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Inductance:\n",
+ "L = 0.386133 mH\n",
+ "Observed Q-factor:\n",
+ "Q = 97.05 \n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_2,pg 240"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# truncation error\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fs=50*10**3 #sampling rate\n",
+ "delt=2.0 #summation interval\n",
+ "f=50.0 #signal frequency\n",
+ "\n",
+ "#Calculations\n",
+ "n=(fs/delt) #value of samples for 2s\n",
+ "maxer1=100.0/(2*n) #max error for synchronous case\n",
+ "maxer2=(100.0/(2*fs*delt*math.sin((2*math.pi*f)/fs)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"max error for synchronous case:\")\n",
+ "print(\"maxer1 = %.3f%% \\n\"%maxer1)\n",
+ "print(\"max error for asynchronous case:\")\n",
+ "print(\"maxer2 = %.2f%% \"%maxer2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "max error for synchronous case:\n",
+ "maxer1 = 0.002% \n",
+ "\n",
+ "max error for asynchronous case:\n",
+ "maxer2 = 0.08% \n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_3,pg 258"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find ratio errror and phase angle\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#assume no iron loss and magnetizing current=1% of 10A, i.e 0.01A\n",
+ "Xs=1.884 #reactance of secondary\n",
+ "Rs=0.5 #resistance of secondary\n",
+ "Xm=2.0 #reactance of meter\n",
+ "Rm=0.4 #reactance of meter\n",
+ "Im=0.01 #magnetizing current\n",
+ "n2=10\n",
+ "n1=1\n",
+ "\n",
+ "#Calculations\n",
+ "B=math.atan((Xs+Xm)/(Rs+Rm))\n",
+ "#nominal ratio (n2/n1)=10/1\n",
+ "R=n2+((Im*math.sin(B))/n1) #actual impedance\n",
+ "R1=0.0097 #practical impedance\n",
+ "perer=(R1/R)*100 #percentage error\n",
+ "theta=((Im*math.cos(B))/n2)\n",
+ "\n",
+ "#Result\n",
+ "print(\"percentage error = %.3f%% \\n\"%perer)\n",
+ "print(\"phase angle:\")\n",
+ "print(\"theta = %.5f rad\"%(math.floor(theta*10**5)/10**5))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "percentage error = 0.097% \n",
+ "\n",
+ "phase angle:\n",
+ "theta = 0.00022 rad\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_4,pg 499"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# inductor Q factor and resistance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vc=100.0 #voltage across capacitor\n",
+ "Vi=12.0 #input voltage\n",
+ "f=100.0 #frequency of operation\n",
+ "Vl=100.0 #Vc=Vl at resonance\n",
+ "Ir=5.0 #current at resonance\n",
+ "\n",
+ "#Calculations\n",
+ "Q=(Vc/Vi) #Q-factor\n",
+ "Xl=(Vl/Ir) #inductive reactance\n",
+ "L=(Xl/(2*math.pi*f)) #inductance\n",
+ "Rl=(Xl/Q) #resistance\n",
+ "\n",
+ "#Result\n",
+ "print(\"Inductance of coil:\")\n",
+ "print(\"L = %.1f mH\\n\"%(L*1000))\n",
+ "print(\"Q-factor:\")\n",
+ "print(\"Q = %.2f\\n\"%Q)\n",
+ "print(\"Resistance of coil:\")\n",
+ "print(\"Rl = %.1f ohm\"%Rl)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Inductance of coil:\n",
+ "L = 31.8 mH\n",
+ "\n",
+ "Q-factor:\n",
+ "Q = 8.33\n",
+ "\n",
+ "Resistance of coil:\n",
+ "Rl = 2.4 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_5,pg 499"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# actual Q factor and resistance\n",
+ "\n",
+ "import math\n",
+ "# Variable declaration\n",
+ "#when switch is open\n",
+ "C1=0.011*10**-6 #capacitance-1\n",
+ "Q1=10.0 #Q-factor-1\n",
+ "#when switch is closed\n",
+ "C2=0.022*10**-6 #capacitance-2\n",
+ "Q2=100.0 #Q-factor-2\n",
+ "\n",
+ "#Calculations\n",
+ "Qac=((Q1*Q2)/(Q1-Q2))*((C1-C2)/C1) #actual Q-factor\n",
+ "Rp=((Q1*Q2)/(Q2-Q1))*(1/(2*math.pi*C2)) #parallel resistance\n",
+ "\n",
+ "#Result\n",
+ "print(\"actual Q-factor:\")\n",
+ "print(\"Qac = %.2f \\n\"%Qac)\n",
+ "print(\"parallel resistance:\")\n",
+ "print(\"Rp = %.f M-ohm\"%(Rp/10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "actual Q-factor:\n",
+ "Qac = 11.11 \n",
+ "\n",
+ "parallel resistance:\n",
+ "Rp = 80 M-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_6,pg 499"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find Q factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Cr=0.01*10**-6 #capacitance at resonance\n",
+ "Cu=0.014*10**-6 #capacitance at upper half\n",
+ "Cl=0.008*10**-6 #capacitance at lower half\n",
+ "\n",
+ "#Calculations\n",
+ "Qac=((2*Cr)/(Cu-Cl)) #actual Q-factor\n",
+ "\n",
+ "#Result\n",
+ "print(\"actual Q-factor:\")\n",
+ "print(\"Qac = %.2f \"%Qac)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "actual Q-factor:\n",
+ "Qac = 3.33 \n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_7,pg 499"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find lag\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "V=10.0 #v=10sin6280t\n",
+ "I=1.0 #current peak\n",
+ "P=3.1 #active power\n",
+ "\n",
+ "#Calculations\n",
+ "phi=math.acos((P*2)/V) #phase in radian\n",
+ "w=6280.0 #v=10sin6280t\n",
+ "lag=(phi/w) #lag\n",
+ "\n",
+ "#Result\n",
+ "print(\"lag = %.2f ms\"%(lag*10**3))\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "lag = 0.14 ms\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_8,pg 500"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find truncation error\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "V=4.0 #peak voltage\n",
+ "I=0.4 #peak current\n",
+ "f=1*10**3 #operating frequency\n",
+ "fs=40*10**3 #sampling rate\n",
+ "delt=2.2 #time interval\n",
+ "\n",
+ "#Calculations\n",
+ "phi=((2*math.pi*f)/fs) #phase \n",
+ "Et=(V*I*phi)/(4*math.pi*f*delt*math.sin(phi))\n",
+ "\n",
+ "#Result\n",
+ "print(\"truncation error:\")\n",
+ "print(\"Et = %.1f * 10^-6 \"%(Et*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "truncation error:\n",
+ "Et = 58.1 * 10^-6 \n"
+ ]
+ }
+ ],
+ "prompt_number": 36
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_9,pg 500"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find frequency of PF meter\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "ar=1.0 #gain of rectifier\n",
+ "nc=40.0 #turns ratio (1:40)\n",
+ "Vm=4.0 #peak load voltage\n",
+ "PF=0.85 #power factor\n",
+ "\n",
+ "#Calculations\n",
+ "f=(1/math.pi)*ar*Vm*nc*PF #frequency\n",
+ "\n",
+ "#Result\n",
+ "print(\"frequency of digital power meter:\")\n",
+ "print(\"f = %.1f Hz\"%f)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "frequency of digital power meter:\n",
+ "f = 43.3 Hz\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_10,pg 500"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# calculate ratio error and phase angle\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Rp=94.0 #primary resistance\n",
+ "Xp=64.3 #primary reactance\n",
+ "Rs=0.85*10**2 #secondary resistance\n",
+ "Im=31*10**-3 #magnetizing current\n",
+ "PF=0.4 #power factor\n",
+ "n=10.0 #PT ratio\n",
+ "Is=1.0 #load current\n",
+ "Vs=110.0 #n=(Vp/Vs)\n",
+ "\n",
+ "#Calculations\n",
+ "B=math.acos(PF)\n",
+ "beta = math.floor(math.sin(B)*10)/10\n",
+ "R=Rp+Rs #total resistance\n",
+ "nerr=n+((((Is/n)*((R*PF)+(Xp*beta)))+Im*Xp)/Vs)\n",
+ "theta=((PF*(Xp/n))-(beta*(R/n))-(Im*Rp))/(Vs*n)\n",
+ "\n",
+ "#Result\n",
+ "print(\"ratio error:\")\n",
+ "print(\"nerr = %.3f\\n\"%nerr)\n",
+ "print(\"phase angle:\")\n",
+ "print(\"theta = %.3f\"%theta)\n",
+ "#Answer for theta do not match with the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "ratio error:\n",
+ "nerr = 10.136\n",
+ "\n",
+ "phase angle:\n",
+ "theta = -0.015\n"
+ ]
+ }
+ ],
+ "prompt_number": 52
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_11,pg 500"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# calculate ratio error and phase angle\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "n=20.0 #(Vs/Is)\n",
+ "Is=5.0 #n=(Vs/Is)\n",
+ "Vs=100.0 #n=(Vs/Is)\n",
+ "N=0.25 #resistance to reactance ratio\n",
+ "Bur=15.0 #burden of CT=15VA (rating)\n",
+ "IL=0.13 #iron loss\n",
+ "Im=1.3 #magnetizing current\n",
+ "\n",
+ "#Calculations\n",
+ "V=(Bur/Is) #voltage rating\n",
+ "B=math.atan(N) #cos(B)-> power factor\n",
+ "#B=B*(180/math.pi) #conversion into degree\n",
+ "I=(Bur/Vs) #current rating\n",
+ "I1=(IL/I)\n",
+ "Rac=0.23 #actual value\n",
+ "R=n+((I1*math.cos(B)+Im*math.sin(B))/Is)\n",
+ "theta=((Im*math.cos(B)-I1*math.sin(B))/Vs)\n",
+ "nerr=-(Rac/R)*100 #ratio error\n",
+ "\n",
+ "# Result\n",
+ "print(\"ratio error:\")\n",
+ "print(\"nerr = %.3f%%\\n \"%nerr)\n",
+ "print(\"phase angle \\n\")\n",
+ "print(\"theta = %.4f\u00b0 \"%theta)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "ratio error:\n",
+ "nerr = -1.137%\n",
+ " \n",
+ "phase angle \n",
+ "\n",
+ "theta = 0.0105\u00b0 \n"
+ ]
+ }
+ ],
+ "prompt_number": 56
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch8_2.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch8_2.ipynb new file mode 100755 index 00000000..a772bd9b --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch8_2.ipynb @@ -0,0 +1,561 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 8 : Q factor Power and Power Factor"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_1,pg 234"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Q factor of coil\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fr= 400.0*10**3 #resonance frequency\n",
+ "C = 400.0*10**-12 #tuned capacitance\n",
+ "R = 10.0 #resistance of coil\n",
+ "n = 40.0 #Cp=nC\n",
+ "\n",
+ "#Calculations\n",
+ "Cp=n*(100.0/400.0)*10**-12 \n",
+ "L=(1.0/(4*(math.pi**2)*(fr**2)*(C+Cp)))\n",
+ "Q=2*math.pi*fr*(L/R)\n",
+ "\n",
+ "#Result\n",
+ "print(\"Inductance:\\nL = %f mH\"%(L*1000))\n",
+ "print(\"Observed Q-factor:\")\n",
+ "print(\"Q = %.2f \"%Q)\n",
+ "# Aanswer do not match with the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Inductance:\n",
+ "L = 0.386133 mH\n",
+ "Observed Q-factor:\n",
+ "Q = 97.05 \n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_2,pg 240"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# truncation error\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fs=50*10**3 #sampling rate\n",
+ "delt=2.0 #summation interval\n",
+ "f=50.0 #signal frequency\n",
+ "\n",
+ "#Calculations\n",
+ "n=(fs/delt) #value of samples for 2s\n",
+ "maxer1=100.0/(2*n) #max error for synchronous case\n",
+ "maxer2=(100.0/(2*fs*delt*math.sin((2*math.pi*f)/fs)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"max error for synchronous case:\")\n",
+ "print(\"maxer1 = %.3f%% \\n\"%maxer1)\n",
+ "print(\"max error for asynchronous case:\")\n",
+ "print(\"maxer2 = %.2f%% \"%maxer2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "max error for synchronous case:\n",
+ "maxer1 = 0.002% \n",
+ "\n",
+ "max error for asynchronous case:\n",
+ "maxer2 = 0.08% \n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_3,pg 258"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find ratio errror and phase angle\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "#assume no iron loss and magnetizing current=1% of 10A, i.e 0.01A\n",
+ "Xs=1.884 #reactance of secondary\n",
+ "Rs=0.5 #resistance of secondary\n",
+ "Xm=2.0 #reactance of meter\n",
+ "Rm=0.4 #reactance of meter\n",
+ "Im=0.01 #magnetizing current\n",
+ "n2=10\n",
+ "n1=1\n",
+ "\n",
+ "#Calculations\n",
+ "B=math.atan((Xs+Xm)/(Rs+Rm))\n",
+ "#nominal ratio (n2/n1)=10/1\n",
+ "R=n2+((Im*math.sin(B))/n1) #actual impedance\n",
+ "R1=0.0097 #practical impedance\n",
+ "perer=(R1/R)*100 #percentage error\n",
+ "theta=((Im*math.cos(B))/n2)\n",
+ "\n",
+ "#Result\n",
+ "print(\"percentage error = %.3f%% \\n\"%perer)\n",
+ "print(\"phase angle:\")\n",
+ "print(\"theta = %.5f rad\"%(math.floor(theta*10**5)/10**5))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "percentage error = 0.097% \n",
+ "\n",
+ "phase angle:\n",
+ "theta = 0.00022 rad\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_4,pg 499"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# inductor Q factor and resistance\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vc=100.0 #voltage across capacitor\n",
+ "Vi=12.0 #input voltage\n",
+ "f=100.0 #frequency of operation\n",
+ "Vl=100.0 #Vc=Vl at resonance\n",
+ "Ir=5.0 #current at resonance\n",
+ "\n",
+ "#Calculations\n",
+ "Q=(Vc/Vi) #Q-factor\n",
+ "Xl=(Vl/Ir) #inductive reactance\n",
+ "L=(Xl/(2*math.pi*f)) #inductance\n",
+ "Rl=(Xl/Q) #resistance\n",
+ "\n",
+ "#Result\n",
+ "print(\"Inductance of coil:\")\n",
+ "print(\"L = %.1f mH\\n\"%(L*1000))\n",
+ "print(\"Q-factor:\")\n",
+ "print(\"Q = %.2f\\n\"%Q)\n",
+ "print(\"Resistance of coil:\")\n",
+ "print(\"Rl = %.1f ohm\"%Rl)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Inductance of coil:\n",
+ "L = 31.8 mH\n",
+ "\n",
+ "Q-factor:\n",
+ "Q = 8.33\n",
+ "\n",
+ "Resistance of coil:\n",
+ "Rl = 2.4 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_5,pg 499"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# actual Q factor and resistance\n",
+ "\n",
+ "import math\n",
+ "# Variable declaration\n",
+ "#when switch is open\n",
+ "C1=0.011*10**-6 #capacitance-1\n",
+ "Q1=10.0 #Q-factor-1\n",
+ "#when switch is closed\n",
+ "C2=0.022*10**-6 #capacitance-2\n",
+ "Q2=100.0 #Q-factor-2\n",
+ "\n",
+ "#Calculations\n",
+ "Qac=((Q1*Q2)/(Q1-Q2))*((C1-C2)/C1) #actual Q-factor\n",
+ "Rp=((Q1*Q2)/(Q2-Q1))*(1/(2*math.pi*C2)) #parallel resistance\n",
+ "\n",
+ "#Result\n",
+ "print(\"actual Q-factor:\")\n",
+ "print(\"Qac = %.2f \\n\"%Qac)\n",
+ "print(\"parallel resistance:\")\n",
+ "print(\"Rp = %.f M-ohm\"%(Rp/10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "actual Q-factor:\n",
+ "Qac = 11.11 \n",
+ "\n",
+ "parallel resistance:\n",
+ "Rp = 80 M-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_6,pg 499"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find Q factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Cr=0.01*10**-6 #capacitance at resonance\n",
+ "Cu=0.014*10**-6 #capacitance at upper half\n",
+ "Cl=0.008*10**-6 #capacitance at lower half\n",
+ "\n",
+ "#Calculations\n",
+ "Qac=((2*Cr)/(Cu-Cl)) #actual Q-factor\n",
+ "\n",
+ "#Result\n",
+ "print(\"actual Q-factor:\")\n",
+ "print(\"Qac = %.2f \"%Qac)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "actual Q-factor:\n",
+ "Qac = 3.33 \n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_7,pg 499"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find lag\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "V=10.0 #v=10sin6280t\n",
+ "I=1.0 #current peak\n",
+ "P=3.1 #active power\n",
+ "\n",
+ "#Calculations\n",
+ "phi=math.acos((P*2)/V) #phase in radian\n",
+ "w=6280.0 #v=10sin6280t\n",
+ "lag=(phi/w) #lag\n",
+ "\n",
+ "#Result\n",
+ "print(\"lag = %.2f ms\"%(lag*10**3))\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "lag = 0.14 ms\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_8,pg 500"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find truncation error\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "V=4.0 #peak voltage\n",
+ "I=0.4 #peak current\n",
+ "f=1*10**3 #operating frequency\n",
+ "fs=40*10**3 #sampling rate\n",
+ "delt=2.2 #time interval\n",
+ "\n",
+ "#Calculations\n",
+ "phi=((2*math.pi*f)/fs) #phase \n",
+ "Et=(V*I*phi)/(4*math.pi*f*delt*math.sin(phi))\n",
+ "\n",
+ "#Result\n",
+ "print(\"truncation error:\")\n",
+ "print(\"Et = %.1f * 10^-6 \"%(Et*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "truncation error:\n",
+ "Et = 58.1 * 10^-6 \n"
+ ]
+ }
+ ],
+ "prompt_number": 36
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_9,pg 500"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find frequency of PF meter\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "ar=1.0 #gain of rectifier\n",
+ "nc=40.0 #turns ratio (1:40)\n",
+ "Vm=4.0 #peak load voltage\n",
+ "PF=0.85 #power factor\n",
+ "\n",
+ "#Calculations\n",
+ "f=(1/math.pi)*ar*Vm*nc*PF #frequency\n",
+ "\n",
+ "#Result\n",
+ "print(\"frequency of digital power meter:\")\n",
+ "print(\"f = %.1f Hz\"%f)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "frequency of digital power meter:\n",
+ "f = 43.3 Hz\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_10,pg 500"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# calculate ratio error and phase angle\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Rp=94.0 #primary resistance\n",
+ "Xp=64.3 #primary reactance\n",
+ "Rs=0.85*10**2 #secondary resistance\n",
+ "Im=31*10**-3 #magnetizing current\n",
+ "PF=0.4 #power factor\n",
+ "n=10.0 #PT ratio\n",
+ "Is=1.0 #load current\n",
+ "Vs=110.0 #n=(Vp/Vs)\n",
+ "\n",
+ "#Calculations\n",
+ "B=math.acos(PF)\n",
+ "beta = math.floor(math.sin(B)*10)/10\n",
+ "R=Rp+Rs #total resistance\n",
+ "nerr=n+((((Is/n)*((R*PF)+(Xp*beta)))+Im*Xp)/Vs)\n",
+ "theta=((PF*(Xp/n))-(beta*(R/n))-(Im*Rp))/(Vs*n)\n",
+ "\n",
+ "#Result\n",
+ "print(\"ratio error:\")\n",
+ "print(\"nerr = %.3f\\n\"%nerr)\n",
+ "print(\"phase angle:\")\n",
+ "print(\"theta = %.3f\"%theta)\n",
+ "#Answer for theta do not match with the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "ratio error:\n",
+ "nerr = 10.136\n",
+ "\n",
+ "phase angle:\n",
+ "theta = -0.015\n"
+ ]
+ }
+ ],
+ "prompt_number": 52
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8_11,pg 500"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# calculate ratio error and phase angle\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "n=20.0 #(Vs/Is)\n",
+ "Is=5.0 #n=(Vs/Is)\n",
+ "Vs=100.0 #n=(Vs/Is)\n",
+ "N=0.25 #resistance to reactance ratio\n",
+ "Bur=15.0 #burden of CT=15VA (rating)\n",
+ "IL=0.13 #iron loss\n",
+ "Im=1.3 #magnetizing current\n",
+ "\n",
+ "#Calculations\n",
+ "V=(Bur/Is) #voltage rating\n",
+ "B=math.atan(N) #cos(B)-> power factor\n",
+ "#B=B*(180/math.pi) #conversion into degree\n",
+ "I=(Bur/Vs) #current rating\n",
+ "I1=(IL/I)\n",
+ "Rac=0.23 #actual value\n",
+ "R=n+((I1*math.cos(B)+Im*math.sin(B))/Is)\n",
+ "theta=((Im*math.cos(B)-I1*math.sin(B))/Vs)\n",
+ "nerr=-(Rac/R)*100 #ratio error\n",
+ "\n",
+ "# Result\n",
+ "print(\"ratio error:\")\n",
+ "print(\"nerr = %.3f%%\\n \"%nerr)\n",
+ "print(\"phase angle \\n\")\n",
+ "print(\"theta = %.4f\u00b0 \"%theta)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "ratio error:\n",
+ "nerr = -1.137%\n",
+ " \n",
+ "phase angle \n",
+ "\n",
+ "theta = 0.0105\u00b0 \n"
+ ]
+ }
+ ],
+ "prompt_number": 56
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch9.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch9.ipynb new file mode 100755 index 00000000..887c53e4 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch9.ipynb @@ -0,0 +1,279 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 9 : Analyzers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9_1,pg 501"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# variable frequency oscillator\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fc=1.3*10**6 #centre frequency\n",
+ "fsignal=1*10**6 #frequency of the signal\n",
+ "fvfo=0.3*10**6 #frequency of variable frequency oscillator\n",
+ "\n",
+ "#Calculations\n",
+ "per=(fvfo/fc)*100\n",
+ "\n",
+ "#Result\n",
+ "print(\"percent variation:\")\n",
+ "print(\"per = %.2f%%\"%(math.floor(per*100)/100))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "percent variation:\n",
+ "per = 23.07%\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9_2,pg 502"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# DFT coefficients\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "N=22.0 #no. of acquistioned data\n",
+ "delt=2*10**-3 #time period\n",
+ "n=4.0 #4th DFT coeff.\n",
+ "q=3.0 #no. of discrete points\n",
+ "\n",
+ "#Calculations\n",
+ "#An=(2/N)*V(n)*cos((2*%pi*n*q)/N)\n",
+ "#Bn=(2/N)*V(n)*sin((2*%pi*n*q)/N)\n",
+ "\n",
+ "#Result\n",
+ "print(\"A4=(1/11)V(4)cos(12pi/11)\\n\")\n",
+ "print(\"B4=(1/11)V(4)sin(12pi/11)\\n\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A4=(1/11)V(4)cos(12pi/11)\n",
+ "\n",
+ "B4=(1/11)V(4)sin(12pi/11)\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9_3,pg 502"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find improvement ratio\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "N=64.0 #data units\n",
+ "#implimentation steps for DFT=64^2\n",
+ "\n",
+ "#Calculations\n",
+ "#for FFT\n",
+ "r= math.log(N,2)/N #implimentation ratio\n",
+ "\n",
+ "#Result\n",
+ "print(\"implimentation ratio:\")\n",
+ "print(\"r = %.5f or (3/32)\"%r)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "implimentation ratio:\n",
+ "r = 0.09375 or (3/32)\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9_4,pg 502"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find distortion factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "D3=1.3*10**-2 #3rd harmonic(unit value)\n",
+ "D5=0.31*10**-2 #5th harmonic(unit value)\n",
+ "D7=0.04*10**-2 #7th harmonic(unit value)\n",
+ "\n",
+ "#Calculations\n",
+ "Dt=math.sqrt((D3**2)+(D5**2)+(D7**2))\n",
+ "\n",
+ "#Result\n",
+ "print(\"distortion ratio:\")\n",
+ "print(\"Dt = %.5f \"%Dt)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "distortion ratio:\n",
+ "Dt = 0.01337 \n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9_5,pg 502"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find percentage change in feedback\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Q=10.0 #Q-factor\n",
+ "m=5.0 #improvement factor\n",
+ "a=(1.0/((3*Q)-1)) #filter factor\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "Qr=Q*m #rejection Q-factor\n",
+ "ar=(1.0/((3*Qr)-1)) #rejection filter factor\n",
+ "perf=((a-ar)/a)*100 #percent change in feedback\n",
+ "\n",
+ "#Result\n",
+ "print(\"percent change in feedback:\")\n",
+ "print(\"perf = %.2f \"%perf)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "percent change in feedback:\n",
+ "perf = 80.54 \n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9_6,pg 503"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# time uncertainity and measurable time\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fc=100.0*10**6 #clock frequency\n",
+ "Nm=4.0*10**6 #memory size\n",
+ "\n",
+ "#Calculations\n",
+ "Te=(1.0/fc) #timing uncertainity\n",
+ "Tm=(Nm/fc) #measurable time\n",
+ "\n",
+ "#Result\n",
+ "print(\"timing uncertainity:\")\n",
+ "print(\"Te = %.f ns\\n\"%(Te*10**9))\n",
+ "print(\"measurable time:\")\n",
+ "print(\"Tm = %.f m\"%(Tm*10**3))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "timing uncertainity:\n",
+ "Te = 10 ns\n",
+ "\n",
+ "measurable time:\n",
+ "Tm = 40 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch9_1.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch9_1.ipynb new file mode 100755 index 00000000..887c53e4 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch9_1.ipynb @@ -0,0 +1,279 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 9 : Analyzers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9_1,pg 501"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# variable frequency oscillator\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fc=1.3*10**6 #centre frequency\n",
+ "fsignal=1*10**6 #frequency of the signal\n",
+ "fvfo=0.3*10**6 #frequency of variable frequency oscillator\n",
+ "\n",
+ "#Calculations\n",
+ "per=(fvfo/fc)*100\n",
+ "\n",
+ "#Result\n",
+ "print(\"percent variation:\")\n",
+ "print(\"per = %.2f%%\"%(math.floor(per*100)/100))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "percent variation:\n",
+ "per = 23.07%\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9_2,pg 502"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# DFT coefficients\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "N=22.0 #no. of acquistioned data\n",
+ "delt=2*10**-3 #time period\n",
+ "n=4.0 #4th DFT coeff.\n",
+ "q=3.0 #no. of discrete points\n",
+ "\n",
+ "#Calculations\n",
+ "#An=(2/N)*V(n)*cos((2*%pi*n*q)/N)\n",
+ "#Bn=(2/N)*V(n)*sin((2*%pi*n*q)/N)\n",
+ "\n",
+ "#Result\n",
+ "print(\"A4=(1/11)V(4)cos(12pi/11)\\n\")\n",
+ "print(\"B4=(1/11)V(4)sin(12pi/11)\\n\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A4=(1/11)V(4)cos(12pi/11)\n",
+ "\n",
+ "B4=(1/11)V(4)sin(12pi/11)\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9_3,pg 502"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find improvement ratio\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "N=64.0 #data units\n",
+ "#implimentation steps for DFT=64^2\n",
+ "\n",
+ "#Calculations\n",
+ "#for FFT\n",
+ "r= math.log(N,2)/N #implimentation ratio\n",
+ "\n",
+ "#Result\n",
+ "print(\"implimentation ratio:\")\n",
+ "print(\"r = %.5f or (3/32)\"%r)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "implimentation ratio:\n",
+ "r = 0.09375 or (3/32)\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9_4,pg 502"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find distortion factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "D3=1.3*10**-2 #3rd harmonic(unit value)\n",
+ "D5=0.31*10**-2 #5th harmonic(unit value)\n",
+ "D7=0.04*10**-2 #7th harmonic(unit value)\n",
+ "\n",
+ "#Calculations\n",
+ "Dt=math.sqrt((D3**2)+(D5**2)+(D7**2))\n",
+ "\n",
+ "#Result\n",
+ "print(\"distortion ratio:\")\n",
+ "print(\"Dt = %.5f \"%Dt)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "distortion ratio:\n",
+ "Dt = 0.01337 \n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9_5,pg 502"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find percentage change in feedback\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Q=10.0 #Q-factor\n",
+ "m=5.0 #improvement factor\n",
+ "a=(1.0/((3*Q)-1)) #filter factor\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "Qr=Q*m #rejection Q-factor\n",
+ "ar=(1.0/((3*Qr)-1)) #rejection filter factor\n",
+ "perf=((a-ar)/a)*100 #percent change in feedback\n",
+ "\n",
+ "#Result\n",
+ "print(\"percent change in feedback:\")\n",
+ "print(\"perf = %.2f \"%perf)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "percent change in feedback:\n",
+ "perf = 80.54 \n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9_6,pg 503"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# time uncertainity and measurable time\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fc=100.0*10**6 #clock frequency\n",
+ "Nm=4.0*10**6 #memory size\n",
+ "\n",
+ "#Calculations\n",
+ "Te=(1.0/fc) #timing uncertainity\n",
+ "Tm=(Nm/fc) #measurable time\n",
+ "\n",
+ "#Result\n",
+ "print(\"timing uncertainity:\")\n",
+ "print(\"Te = %.f ns\\n\"%(Te*10**9))\n",
+ "print(\"measurable time:\")\n",
+ "print(\"Tm = %.f m\"%(Tm*10**3))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "timing uncertainity:\n",
+ "Te = 10 ns\n",
+ "\n",
+ "measurable time:\n",
+ "Tm = 40 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch9_2.ipynb b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch9_2.ipynb new file mode 100755 index 00000000..887c53e4 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/Pinciples_of_electronic_Instrumentation_Ch9_2.ipynb @@ -0,0 +1,279 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 9 : Analyzers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9_1,pg 501"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# variable frequency oscillator\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fc=1.3*10**6 #centre frequency\n",
+ "fsignal=1*10**6 #frequency of the signal\n",
+ "fvfo=0.3*10**6 #frequency of variable frequency oscillator\n",
+ "\n",
+ "#Calculations\n",
+ "per=(fvfo/fc)*100\n",
+ "\n",
+ "#Result\n",
+ "print(\"percent variation:\")\n",
+ "print(\"per = %.2f%%\"%(math.floor(per*100)/100))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "percent variation:\n",
+ "per = 23.07%\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9_2,pg 502"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# DFT coefficients\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "N=22.0 #no. of acquistioned data\n",
+ "delt=2*10**-3 #time period\n",
+ "n=4.0 #4th DFT coeff.\n",
+ "q=3.0 #no. of discrete points\n",
+ "\n",
+ "#Calculations\n",
+ "#An=(2/N)*V(n)*cos((2*%pi*n*q)/N)\n",
+ "#Bn=(2/N)*V(n)*sin((2*%pi*n*q)/N)\n",
+ "\n",
+ "#Result\n",
+ "print(\"A4=(1/11)V(4)cos(12pi/11)\\n\")\n",
+ "print(\"B4=(1/11)V(4)sin(12pi/11)\\n\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A4=(1/11)V(4)cos(12pi/11)\n",
+ "\n",
+ "B4=(1/11)V(4)sin(12pi/11)\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9_3,pg 502"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find improvement ratio\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "N=64.0 #data units\n",
+ "#implimentation steps for DFT=64^2\n",
+ "\n",
+ "#Calculations\n",
+ "#for FFT\n",
+ "r= math.log(N,2)/N #implimentation ratio\n",
+ "\n",
+ "#Result\n",
+ "print(\"implimentation ratio:\")\n",
+ "print(\"r = %.5f or (3/32)\"%r)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "implimentation ratio:\n",
+ "r = 0.09375 or (3/32)\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9_4,pg 502"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find distortion factor\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "D3=1.3*10**-2 #3rd harmonic(unit value)\n",
+ "D5=0.31*10**-2 #5th harmonic(unit value)\n",
+ "D7=0.04*10**-2 #7th harmonic(unit value)\n",
+ "\n",
+ "#Calculations\n",
+ "Dt=math.sqrt((D3**2)+(D5**2)+(D7**2))\n",
+ "\n",
+ "#Result\n",
+ "print(\"distortion ratio:\")\n",
+ "print(\"Dt = %.5f \"%Dt)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "distortion ratio:\n",
+ "Dt = 0.01337 \n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9_5,pg 502"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find percentage change in feedback\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Q=10.0 #Q-factor\n",
+ "m=5.0 #improvement factor\n",
+ "a=(1.0/((3*Q)-1)) #filter factor\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "Qr=Q*m #rejection Q-factor\n",
+ "ar=(1.0/((3*Qr)-1)) #rejection filter factor\n",
+ "perf=((a-ar)/a)*100 #percent change in feedback\n",
+ "\n",
+ "#Result\n",
+ "print(\"percent change in feedback:\")\n",
+ "print(\"perf = %.2f \"%perf)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "percent change in feedback:\n",
+ "perf = 80.54 \n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9_6,pg 503"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# time uncertainity and measurable time\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "fc=100.0*10**6 #clock frequency\n",
+ "Nm=4.0*10**6 #memory size\n",
+ "\n",
+ "#Calculations\n",
+ "Te=(1.0/fc) #timing uncertainity\n",
+ "Tm=(Nm/fc) #measurable time\n",
+ "\n",
+ "#Result\n",
+ "print(\"timing uncertainity:\")\n",
+ "print(\"Te = %.f ns\\n\"%(Te*10**9))\n",
+ "print(\"measurable time:\")\n",
+ "print(\"Tm = %.f m\"%(Tm*10**3))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "timing uncertainity:\n",
+ "Te = 10 ns\n",
+ "\n",
+ "measurable time:\n",
+ "Tm = 40 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/README.txt b/Principles_Of_Electronic_Instrumentation/README.txt new file mode 100755 index 00000000..85a575ac --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/README.txt @@ -0,0 +1,10 @@ +Contributed By: Laxman Sole +Course: btech +College/Institute/Organization: Vishwakarma Institute of Technology, Pune +Department/Designation: Electronics Engineering +Book Title: Principles Of Electronic Instrumentation +Author: D. Patranabis +Publisher: PHI Learning Pvt. Ltd., New Delhi +Year of publication: 2009 +Isbn: 978-81-203-3355-0 +Edition: 2
\ No newline at end of file diff --git a/Principles_Of_Electronic_Instrumentation/screenshots/14_2.png b/Principles_Of_Electronic_Instrumentation/screenshots/14_2.png Binary files differnew file mode 100755 index 00000000..a18565c5 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/screenshots/14_2.png diff --git a/Principles_Of_Electronic_Instrumentation/screenshots/14_2_1.png b/Principles_Of_Electronic_Instrumentation/screenshots/14_2_1.png Binary files differnew file mode 100755 index 00000000..a18565c5 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/screenshots/14_2_1.png diff --git a/Principles_Of_Electronic_Instrumentation/screenshots/14_2_2.png b/Principles_Of_Electronic_Instrumentation/screenshots/14_2_2.png Binary files differnew file mode 100755 index 00000000..a18565c5 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/screenshots/14_2_2.png diff --git a/Principles_Of_Electronic_Instrumentation/screenshots/3_2.png b/Principles_Of_Electronic_Instrumentation/screenshots/3_2.png Binary files differnew file mode 100755 index 00000000..ccf96c04 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/screenshots/3_2.png diff --git a/Principles_Of_Electronic_Instrumentation/screenshots/3_2_1.png b/Principles_Of_Electronic_Instrumentation/screenshots/3_2_1.png Binary files differnew file mode 100755 index 00000000..ccf96c04 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/screenshots/3_2_1.png diff --git a/Principles_Of_Electronic_Instrumentation/screenshots/3_2_2.png b/Principles_Of_Electronic_Instrumentation/screenshots/3_2_2.png Binary files differnew file mode 100755 index 00000000..ccf96c04 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/screenshots/3_2_2.png diff --git a/Principles_Of_Electronic_Instrumentation/screenshots/8_2.png b/Principles_Of_Electronic_Instrumentation/screenshots/8_2.png Binary files differnew file mode 100755 index 00000000..2441fd36 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/screenshots/8_2.png diff --git a/Principles_Of_Electronic_Instrumentation/screenshots/8_2_1.png b/Principles_Of_Electronic_Instrumentation/screenshots/8_2_1.png Binary files differnew file mode 100755 index 00000000..2441fd36 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/screenshots/8_2_1.png diff --git a/Principles_Of_Electronic_Instrumentation/screenshots/8_2_2.png b/Principles_Of_Electronic_Instrumentation/screenshots/8_2_2.png Binary files differnew file mode 100755 index 00000000..2441fd36 --- /dev/null +++ b/Principles_Of_Electronic_Instrumentation/screenshots/8_2_2.png |