{
 "metadata": {
  "name": "",
  "signature": "sha256:6ba3160044fd56988f5c5098ab622aa22c3eae2ec5a701c2274f1da18b060ff5"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 1: Temperature<h1>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 1.1, Page Number: 53<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#variable declaration\n",
      "c=-40.0               #Temp in degree Celcius\n",
      "\n",
      "#calculations\n",
      "k=c+273\n",
      "F=((9.0/5.0)*c)+32.0\n",
      "R=((9.0/5.0)*c)+492.0\n",
      "\n",
      "#Result\n",
      "print('\\nK=%d\u00b0K' %k)\n",
      "print('\\nF=%d\u00b0F' %F)\n",
      "print('\\nR=%d\u00b0R' %R)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "K=233\u00b0K\n",
        "\n",
        "F=-40\u00b0F\n",
        "\n",
        "R=420\u00b0R"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3> Example 1.2, Page Number: 53<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#varable Declaration\n",
      "span=1000.0              #given value of span in \u00b0C\n",
      "accuracy=1.0/100.0       #1% accuracy\n",
      "\n",
      "#calculations\n",
      "err=span*accuracy\n",
      "max_scale=1200.0\n",
      "Range_instr=max_scale+span\n",
      "meter_reading=700.0\n",
      "per_of_err=(err/meter_reading)*100.0\n",
      "\n",
      "#result\n",
      "print('(a)\\nAs error can be either positive or negative') \n",
      "print('\\n the probable error at any point on the scale =\u00b1 %d\u00b0C'%err)\n",
      "print('\\n(b)\\nRange of the Instrument = %d\u00b0C'%Range_instr)\n",
      "print('\\n(c)\\nPercentage of Error = \u00b1 %.2f%% '%per_of_err)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "As error can be either positive or negative\n",
        "\n",
        " the probable error at any point on the scale =\u00b1 10\u00b0C\n",
        "\n",
        "(b)\n",
        "Range of the Instrument = 2200\u00b0C\n",
        "\n",
        "(c)\n",
        "Percentage of Error = \u00b1 1.43% "
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 1.3, Page Number: 54<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#variable declaration\n",
      "resi_per_leg=5.0        # lead wire resistance per leg in Ohm\n",
      "temp_coeff=0.385        # Temperature coefficient of Pt 100 RTD in ohms/\u00b0C\n",
      "\n",
      "#calculation\n",
      "R_due_to_leadwires=2*resi_per_leg\n",
      "err=R_due_to_leadwires/temp_coeff\n",
      "err =round(err,0)\n",
      "temp_obj=200.0\n",
      "temp_measured=temp_obj+err\n",
      "per_of_err=((temp_measured-temp_obj)/temp_obj)*100.0\n",
      "\n",
      "#Result\n",
      "print('(a)\\nThe contribution of 10 ohms lead wire resistance')\n",
      "print('to the measurement error = %d\u00b0C' %err)\n",
      "print('\\n(b)\\nPercentage of Error = %d%%' %per_of_err)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "The contribution of 10 ohms lead wire resistance\n",
        "to the measurement error = 26\u00b0C\n",
        "\n",
        "(b)\n",
        "Percentage of Error = 13%"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 1.4, Page Number: 54<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#variable declaration\n",
      "temp=2.022              #Millivolt corresponds to reference junction temp 50\u00b0C\n",
      "millivolt_cor=37.325    #Millivolt corresponds to reference junction temp 900\u00b0C\n",
      "\n",
      "#calculation\n",
      "op=millivolt_cor-temp\n",
      "\n",
      "#result\n",
      "print('Millivolt output available = % .3f' %op)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Millivolt output available =  35.303"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 1.5, Page Number: 54<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#variable declaration\n",
      "millivolt_cor=2.585         #Millivolt corresponds to reference junction temp 50\u00b0C\n",
      "pot_reading=30.511          #reading on pot\n",
      "\n",
      "#calculation\n",
      "corrected_millivolt=pot_reading+millivolt_cor\n",
      "\n",
      "#result\n",
      "print('Temperature correspond to %.3f mV from the table = 600\u00b0C' %corrected_millivolt)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Temperature correspond to 33.096 mV from the table = 600\u00b0C"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 1.6, Page Number: 54<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#variable Declarion\n",
      "ref_jun=100.0                #reference junction temp.\n",
      "mV_100=0.645                 #voltage at 100\u00b0C\n",
      "mV_1000=9.585                #voltage at 1000\u00b0C\n",
      "mV_1200=11.947               #voltage at 1200\u00b0C\n",
      "\n",
      "#calculation\n",
      "op1=mV_1000-mV_100\n",
      "op2=mV_1200-mV_100\n",
      "\n",
      "#result\n",
      "print('Millivolt to be fed checking 1000 C = %.3f mV'%op1)\n",
      "print('\\nMillivolt to be fed checking 1200 C = %.3f mV'%op2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Millivolt to be fed checking 1000 C = 8.940 mV\n",
        "\n",
        "Millivolt to be fed checking 1200 C = 11.302 mV"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 1.7, page Number: 55<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#variable declaration\n",
      "E_rec_pyro=0.95*0.85        #Energy received by pyrometer\n",
      "\n",
      "#calculation\n",
      "T=1100.0/E_rec_pyro\n",
      "     \n",
      "#result\n",
      "print('Pyrometer reading T = %.2f\u00b0C'%T)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Pyrometer reading T = 1362.23\u00b0C"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 1.8, Page Number: 55<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#(a)\n",
      "\n",
      "#variable declaration\n",
      "hot1_mV=41.29             # Millivolt corresponds to hot junction temp \n",
      "cold1_mV=2.022            # Millivolt corresponds to  cold junction temp \n",
      "\n",
      "#calculation\n",
      "op1=hot1_mV-cold1_mV\n",
      "\n",
      "#(b)\n",
      "\n",
      "#variable declaration\n",
      "hot2_mV=33.096            #Millivolt corresponds to  hot junction temp \n",
      "cold2_mV=2.585            #Millivolt corresponds to  cold junction temp \n",
      "#calculation\n",
      "op2=hot2_mV-cold2_mV\n",
      "\n",
      "#(c)\n",
      "\n",
      "#variable declaration\n",
      "hot3_mV=11.947           #Millivolt corresponds to  hot junction temp \n",
      "cold3_mV=0.299           #Millivolt corresponds to  cold junction temp \n",
      "#calculation\n",
      "op3=hot3_mV-cold3_mV\n",
      "\n",
      "#result\n",
      "print('(a)\\nOutput Millivolt = %.3f'%op1)\n",
      "print('\\n(b)\\nOutput Millivolt = %.3f'%op2)\n",
      "print('\\n(c)\\nAs the wrongly formed thermocouples at J1 and J2 will always oppose')\n",
      "print('the main millivolt output, the net output will be lower than normal value.')\n",
      "print('Output mV<%.3f'%op3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "Output Millivolt = 39.268\n",
        "\n",
        "(b)\n",
        "Output Millivolt = 30.511\n",
        "\n",
        "(c)\n",
        "As the wrongly formed thermocouples at J1 and J2 will always oppose\n",
        "the main millivolt output, the net output will be lower than normal value.\n",
        "Output mV<11.648"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 1.9, Page Number: 56<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#variable declaration\n",
      "Rl_ind=250.0               #load resistor for indicator\n",
      "Rl_rec=250.0               #load resistor for recorder\n",
      "load_allowable=600.0       #allowable load with load independency\n",
      "\n",
      "#calculation\n",
      "load_connected= Rl_ind+Rl_rec\n",
      "max_load_controller=load_allowable-load_connected\n",
      "op_cont=600.0\n",
      "total=Rl_ind+Rl_rec+load_allowable\n",
      "extra_load=total-op_cont\n",
      "\n",
      "#result\n",
      "print('(a)\\nThe max load to the controller = %d ohms'%max_load_controller)\n",
      "print('\\n(b)\\nExtra Load = %d ohms'%extra_load)\n",
      "print('\\nAdditional Power Supply voltage required = 10 V')\n",
      "print('\\nMinimum Power Supply Voltage = 34 ')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "The max load to the controller = 100 ohms\n",
        "\n",
        "(b)\n",
        "Extra Load = 500 ohms\n",
        "\n",
        "Additional Power Supply voltage required = 10 V\n",
        "\n",
        "Minimum Power Supply Voltage = 34 "
       ]
      }
     ],
     "prompt_number": 9
    }
   ],
   "metadata": {}
  }
 ]
}