{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 2: The first law of Thermodynamics" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.1: example_1.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "//Initialization of variables\n", "P1=200 //psia\n", "P2=15 //psia\n", "V1=1 //ft^3\n", "g=1.3\n", "//calculations\n", "V2=V1*(P1/P2)^(1/g)\n", "W=-(144*(P2*V2 - P1*V1)/(g-1))\n", "//results\n", "printf('Work done = %.2e ft. lbf',W)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.2: example_2.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "//Initialization of variables\n", "L=0.305 //m\n", "v=4.58 //m/s\n", "i=10 //A\n", "B=1 //W/m^2\n", "//calculations\n", "F=i*B*L\n", "W=F*v\n", "//results\n", "printf('Force necessary = %.2f N',F)\n", "printf('\n Work per unit time = %.2f W',W)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.3: example_3.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "//Initialization of variables\n", "U=2545 //B/hr\n", "m=50 //lbm\n", "cv=1\n", "//calculations\n", "dT=U/(m*cv)\n", "//results\n", "printf('Change in temperature = %.1f F',dT)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.4: example_4.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "//Initialization of variables\n", "P1=14.7 //psia\n", "V1=1 //ft^3\n", "P2=14.7 //psia\n", "M=28.97\n", "T1=70+460 //R\n", "T2=500+460 //R\n", "cp=0.24 //B/lbm F\n", "//calculations\n", "m=P1*144*V1*M/(1545*T1)\n", "Qp=m*cp*(T2-T1)\n", "V2=V1*P1*T2/(P2*T1)\n", "W=P1*144*(V2-V1)\n", "W=-W/778\n", "dU=Qp+W\n", "//results\n", "printf('Work done = %.2f Btu',W)\n", "printf('\n Heat added = %.2f Btu',Qp)\n", "printf('\n Change in internal energy = %.2f Btu',dU)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.5: example_5.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "//Initialization of variables\n", "l=20 \n", "b=25\n", "h=8\n", "Vp=2.5\n", "n=20\n", "P=14.7//psia\n", "T=530 //R\n", "t=15 //min\n", "Qp=375 //B/hr\n", "cv=0.1715 //B/lbm F\n", "//calculations\n", "Vroom=l*b*h\n", "Vair=Vroom-Vp*n\n", "m=P*Vair*144/(53.35*T)\n", "dU=n*Qp\n", "U=t*dU/60\n", "dT=U/(m*cv)\n", "//results\n", "printf('Air temperature rise = %d F',dT+1)" ] } ], "metadata": { "kernelspec": { "display_name": "Scilab", "language": "scilab", "name": "scilab" }, "language_info": { "file_extension": ".sce", "help_links": [ { "text": "MetaKernel Magics", "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" } ], "mimetype": "text/x-octave", "name": "scilab", "version": "0.7.1" } }, "nbformat": 4, "nbformat_minor": 0 }