{
 "metadata": {
  "name": "",
  "signature": "sha256:6148d2be2796832e7d2e9cefcc5c361a4c9dc07b22c355b627a74bd914199046"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 6: Level<h1>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 6.1,Page Number:370<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#(a)\n",
      "\n",
      "# variable declaration\n",
      "p=1.5                      # pressure applied\n",
      "a=4.0                      # mA corresponds to 0 kg/cm^2\n",
      "b=20.0                     # mA corresponds to 2 kg/cm^2\n",
      "\n",
      "#calculation\n",
      "wh=(((b-a)/2)*p)+a\n",
      "\n",
      "#result\n",
      "print('(a)just at the bottom level of the tank')\n",
      "print('Water head applied to the transmitter =%d mA'%wh)\n",
      "\n",
      "#(b)\n",
      "\n",
      "#calculation\n",
      "wh2=(((b-a)/2)*p)+2*a\n",
      "\n",
      "#result\n",
      "print('\\n\\n(b)5m below the bottom of the tank')\n",
      "print('Water head applied to the transmitter =%d mA' %wh2)\n",
      "\n",
      "#(c)\n",
      "\n",
      "#calculation\n",
      "wh3=(((b-a)/2)*p)\n",
      "\n",
      "#result\n",
      "print('\\n\\n(c)5m above the bottom of the tank')\n",
      "print('Water head applied to the transmitter =%d mA'%wh3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)just at the bottom level of the tank\n",
        "Water head applied to the transmitter =16 mA\n",
        "\n",
        "\n",
        "(b)5m below the bottom of the tank\n",
        "Water head applied to the transmitter =20 mA\n",
        "\n",
        "\n",
        "(c)5m above the bottom of the tank\n",
        "Water head applied to the transmitter =12 mA"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 6.2, Page Number:371<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#(a)\n",
      "\n",
      "#variable declaration\n",
      "b=20.0             # Maximum output\n",
      "a=4.0              # minimum output \n",
      "op=16.0            # output in mA\n",
      "\n",
      "#calculation\n",
      "p=(op-a)*2/(b-a)\n",
      "p_h=p*10.0\n",
      "h=p_h-2-5\n",
      "\n",
      "#result\n",
      "print('(a)\\nh = %dm'%h)\n",
      "\n",
      "#(b)\n",
      "\n",
      "#variable declaration\n",
      "p1=1                # pressure applied\n",
      "\n",
      "#calculation\n",
      "t_op=((b-a)/2)*p1+4\n",
      "\n",
      "#result\n",
      "print('\\n(b)\\nTransmitter output =%d mA'%t_op)\n",
      "\n",
      "#(c)\n",
      "\n",
      "#variable declaration\n",
      "p2=0.5                    # applied pressure\n",
      "\n",
      "#calculation\n",
      "t_op1=((b-a)/2)*p2+4\n",
      "\n",
      "#result\n",
      "print('\\n(c)\\nTransmitter output =%d mA'%t_op1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "h = 8m\n",
        "\n",
        "(b)\n",
        "Transmitter output =12 mA\n",
        "\n",
        "(c)\n",
        "Transmitter output =8 mA"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 6.3, Page Number: 372<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#(a)\n",
      "\n",
      "#variable declaration\n",
      "b=20.0                  # Maximum output\n",
      "a=4.0                   # minimum output\n",
      "op=16.0                 # actual output   \n",
      "wt_l1=25.0              # water level (i)\n",
      "\n",
      "#calculation\n",
      "t_op=((b-a)/100)*(100-75)+4\n",
      "\n",
      "#result\n",
      "print('(a)\\nWater level=+25cm\\nTransmitter output = %d mA' %t_op)\n",
      "\n",
      "#(b)\n",
      "\n",
      "#calculation\n",
      "wt_l2=-25.0            # water level (ii)\n",
      "t_op2=((b-a)/100)*(100-25)+4\n",
      "\n",
      "#result\n",
      "print('\\n(b)\\nWater level=-25cm\\nTransmitter output = %d mA' %t_op2)\n",
      "\n",
      "#(c)\n",
      "\n",
      "#Variable declaration\n",
      "t_op3=12.0             # Transmitter output \n",
      "\n",
      "#calculation\n",
      "H=(100.0/(b-a))*(12-4) \n",
      "\n",
      "#result\n",
      "print('\\n(c)\\nHead Applied = %d cm\\nLevel corresponding to 50 cm head =0 cm' %H)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "Water level=+25cm\n",
        "Transmitter output = 8 mA\n",
        "\n",
        "(b)\n",
        "Water level=-25cm\n",
        "Transmitter output = 16 mA\n",
        "\n",
        "(c)\n",
        "Head Applied = 50 cm\n",
        "Level corresponding to 50 cm head =0 cm"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 6.4, Page Number: 373<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#(a)\n",
      "\n",
      "#variable declaration\n",
      "a=5.0*10**-4                  #area\n",
      "l=8.0                         #length\n",
      "dens=6.0*1000.0               #density\n",
      "\n",
      "#calculation\n",
      "w=a*l*dens\n",
      "\n",
      "#result\n",
      "print('(a)\\nWeight of the displacer if weighed in air = %d kg'%w)\n",
      "\n",
      "\n",
      "#(i)\n",
      "\n",
      "#variable declaration\n",
      "sbr1=23.0                   # spring balance reading\n",
      "\n",
      "#calculation\n",
      "wloss1=w-sbr1\n",
      "L1=wloss1/(1000.0*a)\n",
      "\n",
      "#result\n",
      "print('\\n(i)\\tL1=%dm'%L1)\n",
      "\n",
      "\n",
      "#(ii)\n",
      "\n",
      "#variable declaration\n",
      "sbr2=22.0                  # spring balance reading\n",
      "\n",
      "#calculation\n",
      "wloss2=w-sbr2\n",
      "L2=wloss2/(1000.0*a)\n",
      "\n",
      "#result\n",
      "print('\\n(ii)\\tL2=%dm'%L2)\n",
      "\n",
      "#(iii)\n",
      "\n",
      "#variable declaration\n",
      "sbr3=21.0                # spring balance reading\n",
      "\n",
      "#calculation\n",
      "wloss3=w-sbr3\n",
      "L3=wloss3/(1000.0*a)\n",
      "\n",
      "#result\n",
      "print('\\n(iii)\\tL3=%dm'%L3)\n",
      "\n",
      "#(b)\n",
      "\n",
      "#variable declaration\n",
      "level=8.0                # level wen tank is full     \n",
      "\n",
      "#calculation\n",
      "wt=a*level*1000.0\n",
      "spring=w-wt\n",
      "\n",
      "#result\n",
      "print('\\n(b):when the tank is full\\nSpring Balance reading = %d kg'%spring)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "Weight of the displacer if weighed in air = 24 kg\n",
        "\n",
        "(i)\tL1=2m\n",
        "\n",
        "(ii)\tL2=4m\n",
        "\n",
        "(iii)\tL3=6m\n",
        "\n",
        "(b):when the tank is full\n",
        "Spring Balance reading = 20 kg"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 6.5, Page Number: 374<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#variable declaration\n",
      "rho=1000.0                # density of water \n",
      "v=3.0                     # displaced volume of water \n",
      "\n",
      "#calculation\n",
      "Bw=rho*v\n",
      "\n",
      "#Result\n",
      "print('Buoyance Force(Bw) = %d kg'%Bw)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Buoyance Force(Bw) = 3000 kg"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 6.6, Page Number: 374<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#variable declaration\n",
      "rho=1000.0             # density of water\n",
      "Bw=5000.0              # Buoyancy  Force\n",
      "\n",
      "#calculation\n",
      "v=Bw/rho\n",
      "\n",
      "#result\n",
      "print('V = %d m^3' %v)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "V = 5 m^3"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 6.7, Page Number: 374<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#variable declaration\n",
      "rho=1000.0           # density of water\n",
      "h=10.0               # height of liquid\n",
      "\n",
      "#calculation\n",
      "P=rho*h\n",
      "\n",
      "#result\n",
      "print('P = %d kg/m^2 = %d kg/cm^2 '%(P,P/10000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "P = 10000 kg/m^2 = 1 kg/cm^2 "
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 6.8, Page Number: 374<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#variable declaration\n",
      "rho=1000.0               # density of water\n",
      "h=15.0                   # height of liquid \n",
      "ex_p=1.0                 # External pressure on liquid\n",
      "\n",
      "#calculation\n",
      "P=(rho*h/10000.0)+ex_p\n",
      "\n",
      "#result\n",
      "print('P = %.1f kg/cm^2' %P)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "P = 2.5 kg/cm^2"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 6.9, Page Number:374<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#variable declaration\n",
      "rho=1000.0               # density of water\n",
      "ex_p=0.5*10**4           # External pressure on liquid     \n",
      "P=1.6*10**4              #(rho*h/10000)+ex_p\n",
      "\n",
      "#calculation\n",
      "h=(P-ex_p)/1000.0\n",
      "\n",
      "#result\n",
      "print('h = %d m' %h)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "h = 11 m"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 6.10, Page Number:375<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#variable declaration\n",
      "c2=100.0*10**-6          # capacitance in capacitance probe\n",
      "r1=10.0*10**3            # value of resistor in bride\n",
      "r2=100.0*10**3           # value of resistor in bride\n",
      "r3=50.0*10**3            # value of resistor in bride\n",
      "\n",
      "#calculation\n",
      "Cx=r1*c2/r3\n",
      "Cx=Cx*10**6\n",
      "\n",
      "#result\n",
      "print('Cx = %d microFarad'%Cx)\n",
      "c=5.0\n",
      "\n",
      "#calculation\n",
      "l=Cx/c\n",
      "\n",
      "#result\n",
      "print('\\nLevel on the probe = %dm'%l)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Cx = 20 microFarad\n",
        "\n",
        "Level on the probe = 4m"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}