{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter11:Two Stroke Engines"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.1 page no:367"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Input data\n",
      "nsc=75       #The scavenging efficiency of the two stroke engine in percent \n",
      "ns=20        #The scavenging efficiency is increased by in percent\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "Rsc=math.log(1/(1-(nsc/100.0)))\n",
      "nsc1=(nsc/100.0)+((nsc/100.0)*(ns/100.0))\n",
      "Rsc1=math.log(1/(1-(nsc1)))\n",
      "Rscr=((Rsc1-Rsc)/Rsc)*100      #Percentage increase in scavenging ratio in persent\n",
      "\n",
      "#Output\n",
      "print\"The percentage change in the scavenging ratio = \",round(Rscr,1),\"percent\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The percentage change in the scavenging ratio =  66.1 percent\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.2 page no:367"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Input data\n",
      "d=0.12      #The bore diameter of the engine in m\n",
      "l=0.15      #The stroke length of the engine in m\n",
      "r=16.0        #The compression ratio \n",
      "N=2000.0      #The speed of the engine in rpm\n",
      "mf=(240/60.0) #Actual air flow per min in kg/min\n",
      "T=300.0       #Air inlet temperature in K\n",
      "p=1.025     #Exhaust pressure in bar\n",
      "R=287       #Real gas constant in J/kg\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "da=(p*10**5)/(R*T)\n",
      "Vs=((math.pi)*(d**2)*l)/4.0\n",
      "V=(r/(r-1))*Vs\n",
      "m=da*V\n",
      "m1=m*N\n",
      "Rsc=mf/m1   #Scavenging ratio\n",
      "nsc=((1-math.exp(-Rsc))*100)\n",
      "ntr=((nsc/100.0)/Rsc)*100\n",
      "\n",
      "#Output\n",
      "print\"(a) The scavenging ratio = \",round(Rsc,2)\n",
      "print\"(b) The scavenging efficiency = \",round(nsc,1),\"percent \"\n",
      "print\"(c) The trapping efficiency = \",round(ntr,1),\" percent\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) The scavenging ratio =  0.93\n",
        "(b) The scavenging efficiency =  60.5 percent \n",
        "(c) The trapping efficiency =  65.1  percent\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.3 page no: 368"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Input data\n",
      "mf=6.5          #Mass flow rate of fuel in kg/h\n",
      "N=3000.0          #The speed of the engine in rpm\n",
      "a=15            #The air fuel ratio\n",
      "CV=44000        #The calorific value of the fuel in kJ/kg\n",
      "pm=9            #The mean piston speed in m/s\n",
      "pmi=4.8         #The mean pressure in bar\n",
      "nsc=85          #The scavenging efficiency in percent\n",
      "nm=80           #The mechanical efficiency in percent\n",
      "R=290.0           #Real gas constant in J/kgK\n",
      "p=1.03          #The pressure of the mixture in bar\n",
      "T=288.0           #The temperature of the mixture in K\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "ma=a*mf\n",
      "L=((pm*60)/(2*N))*100\n",
      "mac=mf+ma\n",
      "mi=(mac)/(nsc/100.0)\n",
      "da=(p*10**5)/(R*T)\n",
      "d=(((mi/da)*(4/math.pi)*(1/(L/100.0))*(1/(60*N)))**(1/2.0))*100\n",
      "ip=(pmi*10**5*(L/100)*((math.pi/4.0)*(d/100)**2)*N)/(60*1000)\n",
      "bp=ip*(nm/100.0)\n",
      "nth=(bp/((mf/3600.0)*CV))*100\n",
      "\n",
      "#Output\n",
      "print\"The diameter of the bore = \",round(d,2),\"cm\"\n",
      "print\"The length of the stroke = \",L,\" cm\" \n",
      "print\"The brake power = \",round(bp,2),\" kW\"\n",
      "print\"The brake thermal efficiency =\",round(nth,2),\" percent \"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The diameter of the bore =  8.83 cm\n",
        "The length of the stroke =  9.0  cm\n",
        "The brake power =  10.58  kW\n",
        "The brake thermal efficiency = 13.32  percent \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.4 page no: 369"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Input data\n",
      "d=0.08            #The diameter of the bore in m\n",
      "L=0.1             #The length of the stroke in m\n",
      "r=8.0               #The compression ratio \n",
      "o=60.0              #The exhaust port open before BDC in degrees\n",
      "v=60.0              #The exhaust port closes after BDC in degrees\n",
      "a=15.0              #Air fuel ratio \n",
      "T=300.0             #The temperature of the mixture entering into the engine in K\n",
      "p=1.05            #The pressure in the cylinder at the time of clomath.sing\n",
      "R=290.0             #Real gas constant in J/kgK\n",
      "ma=150.0           #Mass flow rate of air in kg/h\n",
      "N=4000.0            #The speed of the engine in rpm\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "mf=ma/a\n",
      "mac=ma+mf\n",
      "r=(L*100)/2.0\n",
      "Le=(r+(r*math.sin (math.pi/6.0)))/100.0\n",
      "Vse=(math.pi*d**2*Le)/4.0\n",
      "V=(r/(r-1))*Vse\n",
      "V=0.00043                #Value in book after approximation\n",
      "da=(p*10**5)/(R*T)\n",
      "m=V*da\n",
      "mi=m*60*N\n",
      "Rsc=mac/mi \n",
      "nsc=(1-(exp(-Rsc)))*100\n",
      "ntr=nsc/Rsc\n",
      "\n",
      "#Output\n",
      "print\"The scavenging ratio = \",round(Rsc,2)\n",
      "print\"The scavenging efficiency =\",round(nsc,2),\" percent \"\n",
      "print\"The trapping efficiency = \",round(ntr,2),\"percent\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The scavenging ratio =  1.28\n",
        "The scavenging efficiency = 72.32  percent \n",
        "The trapping efficiency =  56.3 percent\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.5 page no: 371"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Input data\n",
      "d=8.25        #The diameter of the bore in cm\n",
      "L=11.25       #The length of the stroke in cm\n",
      "r=8.0           #The compression ratio \n",
      "N=2500.0        #The speed of the engine in rpm\n",
      "ip=17.0         #Indicated power in kW\n",
      "a=0.08        #Fuel air ratio \n",
      "T=345.0         #Inlet temperature mixture in K\n",
      "p=1.02        #Exhaust pressure in bar\n",
      "CV=44000.0      #The calorific value of the fuel in kJ/kg\n",
      "nth=0.29      #Indicated thermal efficiency\n",
      "M=114.0         #Molar mass of fuel \n",
      "R=8314.0        #Universal Gas constant in J/kgK\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "Vs=(math.pi*d**2*L)/4      #Displacement volume in cm**3\n",
      "V=(r/(r-1))*Vs            #Total cylinder volume in m**3\n",
      "ps=((29*p*10**5)/(R*T))*(1/(1+a*(29/M)))         #The density of dry air in kg/m**3\n",
      "nsc=((ip*1000)/((N/60)*V*10**-6*ps*a*CV*1000*nth))*100     #The scavenging efficiency in percent\n",
      "\n",
      "#Output\n",
      "print\"The scavenging efficiency = \",round(nsc,2),\" percent\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The scavenging efficiency =  57.54  percent\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.6 page no: 372"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "S=15.0        #The speed of the math.piston in m/s\n",
      "ps=0.35     #The scavenging pressure in bar\n",
      "pa=1.03     #Atmospheric pressure in bar\n",
      "r=18.0        #The compression ratio \n",
      "t=35.0        #The inlet temperature in degree centigrade\n",
      "Rsc=0.9     #The scavenging ratio \n",
      "ta=15.0       #The atmospheric temperature in degree centigrade\n",
      "nc=0.75     #Compressor efficiency \n",
      "g=1.4       #Adiabatic index\n",
      "R=287.0       #Real gas constant in J/kgK\n",
      "Cp=1005.0     #Specific heat of gas in J/kgK\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "pi=ps+pa    #The scavenging pressure in bar\n",
      "Ti=(273+ta)+t    #The inlet temperature in K\n",
      "pr=pa/math.pi    #The ratio of the pressure for calculations\n",
      "di=(pi*10**5)/(R*Ti)     #The density in kg/m**3\n",
      "ai=(g*R*Ti)**(1/2.0)            #The sonic velocity in m/s\n",
      "C=(Rsc)/(2*((r-1)/r)*(ai/S)*(pi/pa)*((2/(g-1))*(((pr)**(2/g))-((pr)**((g+1)/g))))**(1/2.0))\n",
      "ds=(pa*10**5)/(R*Ti)     #The density in kg/m**3\n",
      "mep=(ds*Rsc*Cp*Ti*(((pi/pa)**((g-1)/g))-1))/((nc*((r-1)/r))*10**5)      #Mean effective pressure in bar\n",
      "\n",
      "#Output\n",
      "print\"The flow coefficient = \",round(C,3) \n",
      "print\"The compressor mean effective pressure =  \",round(mep,1),\"bar\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The flow coefficient =  0.028\n",
        "The compressor mean effective pressure =   0.4 bar\n"
       ]
      }
     ],
     "prompt_number": 33
    }
   ],
   "metadata": {}
  }
 ]
}