summaryrefslogtreecommitdiff
path: root/Industrial_Instrumentation/Chapter_2.ipynb
diff options
context:
space:
mode:
authorJovina Dsouza2014-06-18 12:43:07 +0530
committerJovina Dsouza2014-06-18 12:43:07 +0530
commit206d0358703aa05d5d7315900fe1d054c2817ddc (patch)
treef2403e29f3aded0caf7a2434ea50dd507f6545e2 /Industrial_Instrumentation/Chapter_2.ipynb
parentc6f0d6aeb95beaf41e4b679e78bb42c4ffe45a40 (diff)
downloadPython-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.tar.gz
Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.tar.bz2
Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.zip
adding book
Diffstat (limited to 'Industrial_Instrumentation/Chapter_2.ipynb')
-rw-r--r--Industrial_Instrumentation/Chapter_2.ipynb603
1 files changed, 603 insertions, 0 deletions
diff --git a/Industrial_Instrumentation/Chapter_2.ipynb b/Industrial_Instrumentation/Chapter_2.ipynb
new file mode 100644
index 00000000..f6c4dada
--- /dev/null
+++ b/Industrial_Instrumentation/Chapter_2.ipynb
@@ -0,0 +1,603 @@
+{
+ "metadata": {
+ "name": "Chapter_2"
+ },
+ "nbformat": 2,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ "<h1>Chapter 2: Pressure<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "<h3>Example 2.1, Page Number: 116<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''Pressure conversion'''",
+ "",
+ "#(a)",
+ "",
+ "#variable declaration",
+ "#1kg/cm^2=10000 mmWG",
+ "x=10000.0*10.0 #equivalnt to 10kg/cm^2",
+ "",
+ "#result",
+ "print('(a)\\n 10kg/cm^2 = %.0f mmWG' %x)",
+ "",
+ "#(b)",
+ "",
+ "#variable declaration",
+ "onemm_Hg=13.546 #pressure of 1 mm Hg",
+ "",
+ "#calculation",
+ "y=10.0**5/onemm_Hg",
+ "y=y/10.0**3",
+ "",
+ "#result",
+ "print('\\n(b)\\n10kg/cm^2 = 10^5 mmWG = %.2f * 10^3 mmHg' %y)",
+ "",
+ "#(c)",
+ "",
+ "#variable declaration",
+ "onebar=1.03 # 1 Bar presssure in kg/cm^2",
+ "#calculation",
+ "z=10.0/onebar",
+ "",
+ "#result",
+ "print('\\n(c)\\n10kg/cm^2 = %.2f bars' %z)"
+ ],
+ "language": "python",
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)",
+ " 10kg/cm^2 = 100000 mmWG",
+ "",
+ "(b)",
+ "10kg/cm^2 = 10^5 mmWG = 7.38 * 10^3 mmHg",
+ "",
+ "(c)",
+ "10kg/cm^2 = 9.71 bars"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "<h3>Example 2.2, Page Number: 116<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''Gauge and absolute pressure'''",
+ "",
+ "#(a)",
+ "",
+ "#variable Declaration",
+ "gamm=1000.0 # density of water",
+ "d=35.0 # depth of water ",
+ "dens_Hg=13.546 # density of Hg",
+ "",
+ "#calculation",
+ "press_in_kg_cm=gamm*d*10**-4",
+ "press_in_mmHg=gamm*d/dens_Hg",
+ "press_in_mmHg=press_in_mmHg/10**3",
+ "",
+ "#result",
+ "print('(a)\\nThe pressure at depth of %d meters in a water tank=%.1f kg/cm^2 = %.2f*10^3 mmHg'%(d, press_in_kg_cm, press_in_mmHg))",
+ "",
+ "#(b)",
+ "",
+ "#varible declaration",
+ "press_atm=1.03 #atmospheric pressure",
+ "",
+ "#calculation",
+ "abspress=press_in_kg_cm+press_atm",
+ "abspress_mmHg=press_in_mmHg*1000.0+760.0",
+ "abspress_mmHg=abspress_mmHg/1000.0",
+ "",
+ "#result",
+ "print('\\n(b)\\nAbsolute Pressure= %.2f kg/cm^2 Abs = %.2f*10^3 mmHg Abs'%(abspress, abspress_mmHg))"
+ ],
+ "language": "python",
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)",
+ "The pressure at depth of 35 meters in a water tank=3.5 kg/cm^2 = 2.58*10^3 mmHg",
+ "",
+ "(b)",
+ "Absolute Pressure= 4.53 kg/cm^2 Abs = 3.34*10^3 mmHg Abs"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "<h3>Example 2.3, Page Number:116<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "''' Gauge and absolute pressure'''",
+ "",
+ "#varible declaration",
+ "egp=260.0 # equivalent gauge pressure",
+ "",
+ "#calculation",
+ "abspress=760.0-egp",
+ "",
+ "#result",
+ "print('Absolute Presssure = %d mmHg' %abspress)"
+ ],
+ "language": "python",
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Absolute Presssure = 500 mmHg"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "<h3>Example 2.4,Page Number:117<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''pressure measurement using U tube manometer'''",
+ "",
+ "#(a)",
+ "",
+ "#variable declaration",
+ "p_diff=500.0 #pressure difference in mmHg",
+ "",
+ "#calculations",
+ "pdiff=p_diff*13.546/10000",
+ "",
+ "#Result",
+ "print('(a)\\np1-p2 = %.3f kg/cm^2' %pdiff)",
+ "",
+ "",
+ "#(b)",
+ "",
+ "#variable declaration",
+ "p1=6770.0 # Gauge pressure in mmWG",
+ "p_atm=10300.0 # atmospheric pressure ",
+ "",
+ "#calculation",
+ "abs_p1=p1+p_atm",
+ "",
+ "#result",
+ "print('\\n(b)If p2 is open to atmosphere:\\nAbsolute Pressure P1 = %d mmWG abs.' %abs_p1)",
+ "",
+ "#(c)",
+ "",
+ "#variable declaration",
+ "P1=500.0 #mmHg absolute pressure",
+ "",
+ "#calculations",
+ "P1_gauge=P1-760.0",
+ "",
+ "#result",
+ "print('\\n(c)If p2 is evacuated and sealed:\\np1= %d mmHg gauge Pressure' %P1_gauge)"
+ ],
+ "language": "python",
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)",
+ "p1-p2 = 0.677 kg/cm^2",
+ "",
+ "(b)If p2 is open to atmosphere:",
+ "Absolute Pressure P1 = 17070 mmWG abs.",
+ "",
+ "(c)If p2 is evacuated and sealed:",
+ "p1= -260 mmHg gauge Pressure"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "<h3>Example 2.5, Page Number: 117<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''Specific Gravity and weight density'''",
+ "",
+ "#variable declaration",
+ "spe_grav_water=1.0 # specific gravity of water",
+ "",
+ "#calculation",
+ "spe_grav_X=spe_grav_water*100.0/50.0",
+ "wt_dens_water=1000.0",
+ "wt_dens_X=wt_dens_water*2.0",
+ "",
+ "#result",
+ "print('Weight Density of X = %d kg/m^3' %wt_dens_X)"
+ ],
+ "language": "python",
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Weight Density of X = 2000 kg/m^3"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "<h3>Example 2.6, Page Number: 117<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''water flow rate using mercury manometer'''",
+ "",
+ "#variable declaration",
+ "A=1.0/20.0 # Area ratio",
+ "p_diff=1500.0 # pressure difference in mmWG",
+ "",
+ "#result",
+ "print('(a)\\nAs Delta_h=A2/A1*h << h and normally negligible for well type manometer')",
+ "print('hence, p1-p2 = h = %d =111 mmHg' %p_diff)",
+ "print('\\n(b)\\nh measured above the oriinal reference will be half of H, i.e. 111/2=55.5 mmHg')",
+ "print('(Since area of both legs are same)')"
+ ],
+ "language": "python",
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)",
+ "As Delta_h=A2/A1*h << h and normally negligible for well type manometer",
+ "hence, p1-p2 = h = 1500 =111 mmHg",
+ "",
+ "(b)",
+ "h measured above the oriinal reference will be half of H, i.e. 111/2=55.5 mmHg",
+ "(Since area of both legs are same)"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "<h3>Example 2.7, Page Number: 119<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''readings and errors in Bourdon gauge reading'''",
+ "",
+ "print('1 kg/cm^2 = 10 mWG\\n')",
+ "",
+ "#(a)",
+ "",
+ "#variable declaration",
+ "press=10+2 #pressure read by the gauge",
+ "",
+ "#result",
+ "print('\\n(a)Bourdon Gauge is mounted 20 meters below water line:')",
+ "print('\\nPressure read by the Gauge = %d kg/cm^2'%press)",
+ "",
+ "",
+ "#(b)",
+ "",
+ "#variable declaration",
+ "press2=10-3 #pressure read by the gauge",
+ "",
+ "#result",
+ "print('\\n\\n(b)Bourdon Gauge is located 30 meters above the water line:')",
+ "print('\\nPressure read by the Gauge = %d kg/cm^2'%press2)"
+ ],
+ "language": "python",
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1 kg/cm^2 = 10 mWG",
+ "",
+ "",
+ "(a)Bourdon Gauge is mounted 20 meters below water line:",
+ "",
+ "Pressure read by the Gauge = 12 kg/cm^2",
+ "",
+ "",
+ "(b)Bourdon Gauge is located 30 meters above the water line:",
+ "",
+ "Pressure read by the Gauge = 7 kg/cm^2"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "<h3>Example 2.8, Page Number: 120<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''Specific Gravity and density of liquid'''",
+ "",
+ "#Variable declaration",
+ "dens_water=1000.0 # water Density",
+ "h1=125.0 # height1 mm",
+ "h2=250.0 # height2 mm",
+ "d2=h1*dens_water/h2",
+ "",
+ "#result",
+ "",
+ "#a",
+ "print('(a)\\nDensity of Liquid = %d kg/m^3' %d2)",
+ "print('\\nSpecific Density of the liquid = %.1f' %(h1/h2))",
+ "",
+ "#(b)",
+ "print('\\n\\n(b)\\nIf Values of water and liquid interchanged:\\n')",
+ "d3=h2*dens_water/h1",
+ "print('\\nDensity of Liquid = %d kg/m^3' %d3)",
+ "print('\\nSpecific Density of the liquid = %.1f' %(h2/h1))"
+ ],
+ "language": "python",
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)",
+ "Density of Liquid = 500 kg/m^3",
+ "",
+ "Specific Density of the liquid = 0.5",
+ "",
+ "",
+ "(b)",
+ "If Values of water and liquid interchanged:",
+ "",
+ "",
+ "Density of Liquid = 2000 kg/m^3",
+ "",
+ "Specific Density of the liquid = 2.0"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "<h3>Example 2.9, Page Number: 120<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''strain gauge wire length and cross section area'''",
+ "",
+ "import math",
+ "#variable Declaration",
+ "R=120.0 #resistance",
+ "l=122.0 #length",
+ "a=0.1 #area",
+ "R1=140.0 #resistance in ohm",
+ "",
+ "#calculation",
+ "rho=R*a/l",
+ "l1=math.sqrt(R1*a*l/rho)",
+ "l1=round(l1,0)",
+ "",
+ "#Result",
+ "print('Length l1 = %d meters' %l1)",
+ "A1=a*l/l1",
+ "print('\\nArea A1 = %.4f mm^2' %A1)"
+ ],
+ "language": "python",
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Length l1 = 132 meters",
+ "",
+ "Area A1 = 0.0924 mm^2"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "<h3>Example 2.10, Page Number: 121<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''Capacitance calculation for variable dielectric'''",
+ "",
+ "c=0.57 #Constant",
+ "",
+ "#(a)",
+ "",
+ "#variable declaration",
+ "d=0.1 #distance between plates",
+ "di1=100.0 #Dielectric constant",
+ "di2=1000.0 #Dielectric constant",
+ "",
+ "#calculation",
+ "c1=c*di1*10.0/d",
+ "c1=round(c1,0)",
+ "",
+ "#result",
+ "print('(a)\\nC1=%d pf' %c1)",
+ "",
+ "",
+ "#(b)",
+ "",
+ "#calculation",
+ "c2=c*di2*10/d",
+ "",
+ "#result",
+ "print('\\n(b)\\nC2=%d pf' %c2)",
+ "",
+ "",
+ "#(c)",
+ "",
+ "#calculation",
+ "ds=0.09",
+ "c11=c*di1*10/ds",
+ "c12=c*di2*10/ds",
+ "",
+ "#result",
+ "print('\\n(c)\\nC1 = %.1f pf\\nC2 = %d pf'%(c11,c12))"
+ ],
+ "language": "python",
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)",
+ "C1=5700 pf",
+ "",
+ "(b)",
+ "C2=57000 pf",
+ "",
+ "(c)",
+ "C1 = 6333.3 pf",
+ "C2 = 63333 pf"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "<h3>Example 2.11, Page Number: 121<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''pressure gauge caliberation'''",
+ "",
+ "#variable Declaration",
+ "A=1.0 #area",
+ "p1=10.0 #pressure",
+ "",
+ "#calculation",
+ "W1=A*p1",
+ "",
+ "#Result",
+ "print('W1 = %d kg' %W1)",
+ "print('\\nWith the 4 standard weights of 10kg, 20kg, 30kg and 40kg')"
+ ],
+ "language": "python",
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "W1 = 10 kg",
+ "",
+ "With the 4 standard weights of 10kg, 20kg, 30kg and 40kg"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "<h3>Example 2.12, Page Number: 122<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''pressure calculation using McLeod gauge'''",
+ "",
+ "#varable declaration",
+ "p1=10**-2 #pressure in torr",
+ "h1=20.0 #height in mm",
+ "",
+ "#xalculation",
+ "K=p1/h1**2",
+ "p2=K*30**2",
+ "p2=p2*100.0",
+ "",
+ "#Result",
+ "print('The unknown pressure p2 = %.2f * 10^-2 torr' %p2)"
+ ],
+ "language": "python",
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The unknown pressure p2 = 2.25 * 10^-2 torr"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file