{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 5: Valve Diagrams and Valve Gears" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 1, Page 147" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "\n", "#Variable declaration\n", "s=1.125#inch\n", "e=0.25#inch\n", "t=2.25#inch\n", "alpha=35#degrees\n", "\n", "#Calculations\n", "#from 5.2, we know theta+alpha=sininverse(s/t)\n", "x=math.degrees(math.asin(s/t))\n", "y=180-x#sin(x)=sin(180-x)=sin(y)\n", "#at admission\n", "p=x-alpha\n", "#at cutoff\n", "q=y-alpha\n", "#from 5.3, theta+alpha=sininnverse(-e/t)\n", "ang=math.degrees(math.asin(-e/t))\n", "angle=abs(ang)\n", "a=180+angle#lies in the negative region of sine curve\n", "b=360-angle#lies in hte negative region of sine curve\n", "#at release\n", "r=a-alpha\n", "#at compression\n", "s=b-alpha\n", "\n", "#Results\n", "print \"Angle theta at admission, cut-off,release and compression are %.2f, %.2f, %.2f and %.2f degrees respectively\"%(p,q,r,s)\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Angle theta at admission, cut-off,release and compression are -5.00, 115.00, 151.38 and 318.62 degrees respectively\n" ] } ], "prompt_number": 9 } ], "metadata": {} } ] }