{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "# Chapter 5:Advanced measuring instruments"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Exa 5.1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "A=0.000064\n",
      "B=0.000512\n",
      "since A<B so the instrument is underdamped\n",
      "Number of turns=3356426 \n",
      "current required to overcome friction=0.1 uA \n"
     ]
    }
   ],
   "source": [
    "# 5.1\n",
    "import math\n",
    "D=8*10**-3;\n",
    "A=D**2;\n",
    "print ('A=%f'%A)\n",
    "J=8*10**-3;\n",
    "K=16*10**-3;\n",
    "B=4*J*K;\n",
    "print ('B=%f'%B)\n",
    "print ('since A<B so the instrument is underdamped')\n",
    "th=(100*math.pi)/180;\n",
    "i=10*10**-3;\n",
    "F=0.2*10**-6;\n",
    "G=(K*th+F)/i;\n",
    "l=65*10**-3;\n",
    "d=25*10**-3;\n",
    "N=G/(B*l*d);\n",
    "print (\"Number of turns=%.0f \" %N)\n",
    "i=F/G*10**6;\n",
    "print (\"current required to overcome friction=%.1f uA \" %i)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Exa 5.2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "upper value of range=1896 Hz\n",
      "lower value of range=696 Hz\n",
      "So, the range of the frequency is from 696 to 1896 Hz\n"
     ]
    }
   ],
   "source": [
    "# 5.2\n",
    "import math\n",
    "eta=0.6;\n",
    "fn=2400;\n",
    "M=0.98;\n",
    "#M=1/(((1-u**2)**2)+(2*u*eta)**2)**0.5; ..........(i)\n",
    "# On solving the above equation we get u=0.79\n",
    "u=0.79;\n",
    "fu=u*fn;\n",
    "print (\"upper value of range=%.0f Hz\" %fu)\n",
    "\n",
    "#Now let M=1.02, on solving equation (i) we have u=0.29\n",
    "u=0.29;\n",
    "fl=u*fn;\n",
    "print (\"lower value of range=%.0f Hz\" %fl)\n",
    "print ('So, the range of the frequency is from 696 to 1896 Hz')\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Exa 5.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "phase displacement for the fundamental=7.37 degree\n",
      "phase displacement for the 5th harmonic=40.48 degree\n"
     ]
    }
   ],
   "source": [
    "# 5.3\n",
    "import math\n",
    "eta=0.64;\n",
    "u=0.1;\n",
    "alpha_1=math.degrees(math.atan(2*eta*u/(1-u**2)))\n",
    "print (\"phase displacement for the fundamental=%.2f degree\" %alpha_1)\n",
    "u=0.5;\n",
    "alpha_5=math.degrees(math.atan((2*eta*u/(1-u**2))))\n",
    "print (\"phase displacement for the 5th harmonic=%.2f degree\" %alpha_5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Exa 5.4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Percentage error for the production of 3rd harmonics=-0.56\n",
      "Percentage error for the production of 5th harmonics=-1.54\n",
      "Percentage error for the production of 7th harmonics=-2.97\n",
      "Percentage error for the production of 11th harmonics=-7.03\n",
      "Percentage error for the production of 13th harmonics=-9.55\n",
      " Displacement of 13th harmonic=-1.23 degree\n"
     ]
    }
   ],
   "source": [
    "#5.4\n",
    "import math\n",
    "To=1.0/2000;\n",
    "T=1.0/50;\n",
    "#Rn=1/(1+n**2*(To/T)**2)\n",
    "R1=1.0/(1+1.0**2*(To/T)**2);\n",
    "R3=1.0/(1+3**2*(To/T)**2);\n",
    "R5=1.0/(1+5**2*(To/T)**2);\n",
    "R7=1.0/(1+7**2*(To/T)**2);\n",
    "R11=1.0/(1+11**2*(To/T)**2);\n",
    "R13=1.0/(1+13**2*(To/T)**2);\n",
    "PE3=(R3-1/1)*100;\n",
    "print (\"Percentage error for the production of 3rd harmonics=%.2f\" %PE3)\n",
    "PE5=(R5-1/1)*100;\n",
    "print (\"Percentage error for the production of 5th harmonics=%.2f\" %PE5)\n",
    "PE7=(R7-1/1)*100;\n",
    "print (\"Percentage error for the production of 7th harmonics=%.2f\" %PE7)\n",
    "PE11=(R11-1/1)*100;\n",
    "print (\"Percentage error for the production of 11th harmonics=%.2f\" %PE11)\n",
    "PE13=(R13-1/1)*100;\n",
    "print (\"Percentage error for the production of 13th harmonics=%.2f\" %PE13)\n",
    "#displacement of nth harmonic alpha=atan2*n/((T/To)-n**2*(To/T))\n",
    "alpha_1=math.degrees(math.atan(2*1/((T/To)-(1**2*(To/T)))));\n",
    "alpha_13=(math.degrees(math.atan(2*13/((T/To)-(13**2*(To/T))))));\n",
    "alpha_1_equivalent_13=13*alpha_1;\n",
    "phase_displacement_13=alpha_13-alpha_1_equivalent_13;\n",
    "print (\" Displacement of 13th harmonic=%.2f degree\" %phase_displacement_13)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Exa 5.5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "minimum tape speed=7.81 m/s\n"
     ]
    }
   ],
   "source": [
    "# 5.5\n",
    "import math\n",
    "W_min=2.5*6.25*10**-6;\n",
    "f=500000;\n",
    "S_min=W_min*f;\n",
    "print (\"minimum tape speed=%.2f m/s\" %S_min)\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Exa 5.6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number density of the tape=8 numbers/mm\n"
     ]
    }
   ],
   "source": [
    "# 5.6\n",
    "import math\n",
    "Num_per_sec=12000;\n",
    "S=1.5*10**3;\n",
    "Number_density=Num_per_sec/S;\n",
    "print (\"Number density of the tape=%.0f numbers/mm\" %Number_density)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12+"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
