Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from scipy.integrate import quad\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"ME 3264 - Applied Measurements Laboratory\n",
"=====================================\n",
"\n",
"Lab #1 - Heat Engine\n",
"====================================="
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Objective\n",
"The objectives of this laboratory are :\n",
"\n",
"1. Determination of thermodynamic work done during a four-stage expansion and compression cycle by lifting masses from one height to another.\n",
"1. Compare the useful mechanical work and the net thermodynamic work done during a cycle as determined via a p-V diagram."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Basic thermodynamics concepts\n",
"#### System\n",
"The system is whatever we want to study. It may be as simple as a free body or\n",
"as complex as an entire chemical refinery. Everything external to the system is considered to be part of the system’s surroundings.The system is distinguished from its surroundings by a specified boundary, which may be at rest or in motion. \n",
"\n",
"There are two basic kinds of systems - closed systems (control amss) and open systems (control volumes). A closed system refers to a fixed quantity of matter, whereas a control volume is a region of space through which mass may flow. For exmaple, a quantity of matter contained within a closed, rigid-walled tank is a closed system, while a pipeline through which natural gas flows can be considered as control volume. Closed systems are impermeable to mass but may be permeable to energy. When closed system are impermeable to both mass and energy transfer, the system is known as isolated system.\n",
"\n",
"#### System property\n",
"To describe a system and predict its behavior requires knowledge of its properties\n",
"and how those properties are related. A property is a macroscopic characteristic of a\n",
"system such as mass, volume, energy, pressure, and temperature to which a numerical\n",
"value can be assigned at a given time without knowledge of the previous behavior\n",
"(history) of the system [2].\n",
"\n",
"#### State\n",
"The word \"state\" refers to the condition of a system as described by its properties.\n",
"Since there are normally relations among the properties of a system, the state often\n",
"can be specified by providing the values of a subset of the properties. All other properties\n",
"can be determined in terms of these few [2].\n",
"#### Process and cycle\n",
"When any of the properties of a system changes, the state changes and the system\n",
"is said to undergo a process. If a system undergo sequence of processes that begins and ends at the same state, the system is said to complete thermodynamic cycle.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### First law of thermodynamics\n",
"\n",
"The first law of thermodynamics is a version of the law of conservation of energy, adapted for thermodynamic processes, distinguishing two kinds of transfer of energy, as heat and as thermodynamic work, and relating them to a amount of energy contained within a system.\n",
"\n",
"The energy balance can be expressed in symbols as:\n",
"\n",
"$\\Delta E = Q - W$ (1)\n",
"\n",
"where $\\Delta E$ is the change in amount of energy contained within a system, $Q$ is the net amount of energy\n",
"transferred in across the system boundary by heat transfer, and $W$ is the net amount of energy transferred out across the system boundary by work during the time interval.\n",
"\n",
"The total energy ($E$), is comprised of internal energy ($U$), kinetic energy ($KE$) and potential energy of the system ($PE$). Hence,\n",
"\n",
"$\\Delta E =\\Delta KE+\\Delta PE+\\Delta U$ (2)\n",
"\n",
"if the changes in KE and PE are negligible (i.e. $\\Delta KE=0, \\Delta PE=0$), such as in stationary piston-cylinder engine, the Eq (1) tranforms to Eq (3)\n",
"\n",
"$\\Delta U = Q - W$ (3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Mechanical and thermodynamic work\n",
"\n",
"The mechanical work $W$ done by, or on, a system evaluated in terms of macroscopically observable\n",
"forces ($\\vec{F}$) and displacements ($\\vec{ds}$) is\n",
"\n",
"$W = \\int_{s_1}^{s_2}\\vec{F}.\\vec{ds}$ (4)\n",
"\n",
"Consider an example of a closed system consisting of a gas (or liquid) contained in a piston–cylinder assembly as the gas expands. During the process, the gas pressure exerts a normal force on the piston. A graphical representation of a system with pressure – volume diagram ($p-V$ ) diagram) is shown in Figure 1. \n",
"\n",
"<center><img src=\"./figure_01.png\" alt=\"Drawing\" style=\"width: 300px;\"/> </center>\n",
"<center>Figure 1: Work of a quasi-equillibrium expansion or compression process </center>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The The force exerted by the gas on the piston is simply the product $pA$, where $A$ is the area of the piston face. The work done by the system as the piston is displaced a distance $dx$ is\n",
"\n",
"$\\delta W = pA dx$ (5)\n",
"\n",
"The product $A dx$ equals the change in volume of the system, $dV$. Thus,\n",
"\n",
"$\\delta W = p dV$ (6)\n",
"\n",
"For a change in volume from $V_1$ to $V_2$, the thermodynamic work during the process is obtained by integrating Eq(6)\n",
"\n",
"$W = \\int_{V_1}^{V_2}p dV$ (7)\n",
"\n",
"Note: $\\delta W$ is used for work instead of $dW$ since the differential of work ($W$) is inexact. Meaning, integral of $\\delta W$ cannot be evaluated without specifying the details of the process unlike integral of state properties differentials such as $\\delta V$.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Work during the cycles\n",
"\n",
"Consider the cycle shown in Figure 2. The cycle shown produces a net work output because the work done by the system during the expansion process (area under path A) is greater than the work\n",
"done on the system during the compression part of the cycle (area under path B), and the difference between these two is the net work done during the cycle (the colored area, $W_{cycle}$).\n",
"\n",
"$W_{cycle} = \\oint p dV = \\int_{V_1}^{V_2}p dV + \\int_{V_2}^{V_1}p dV$ (8)\n",
"\n",
"<center><img src=\"./figure_02.png\" alt=\"Drawing\" style=\"width: 300px;\"/> </center>\n",
"<center>Figure 2: The net work done during a cycle is the difference between the work done\n",
"by the system and the work done on the system. </center>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Problem 1\n",
"\n",
"A gas in a piston–cylinder assembly undergoes an expansion process for which the relationship between pressure and volume is given by\n",
"\n",
"$pV^n = constant$\n",
"\n",
"The initial pressure is 3 bar, the initial volume is 0.1 m^3, and the final volume is 0.2 m^3. Determine the work for the process, in kJ, if (a) $n$ = 1.5, (b) $n$ = 1.0, and (c) $n$ = 0.\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The work done during process, W = 17.57 kJ \n"
]
}
],
"source": [
"\n",
"def integrand(V, n, const):\n",
" '''function to return the work done in polytropic process :\n",
" pV^n = const (this could be replaced with appropriate expressions for other processes)\n",
" This function integrates the integrand from V1 to V2 '''\n",
" W = const/V**n\n",
" return W\n",
"\n",
"n = 1.5\n",
"\n",
"V1 = 0.1 # m^3\n",
"V2 = 0.2 # m^3\n",
"p1 = 3 # bar\n",
"const = p1*10**5*V1**n\n",
"p2 = const/(V2**n)\n",
"\n",
"W = quad(integrand, V1, V2, args=(n, const))\n",
"print(\"The work done during process, W = %1.2f kJ \" %(W[0]/1000))\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Check your work\n",
"P1. What is the work done during the process in the above exmaple if $n$ = 1.4 , initial pressure is $5 bar$, the initial volume is $0.05 m^3$ ?\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The work done during process, W = 26.60 kJ \n",
"Nice work!\n"
]
},
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# enter your work here\n",
"\n",
"n = 1.4\n",
"\n",
"V1 = 0.05 # m^3\n",
"V2 = 0.2 # m^3\n",
"p1 = 5 # bar\n",
"const = p1*10**5*V1**n\n",
"p2 = const/(V2**n)\n",
"\n",
"W = quad(integrand, V1, V2, args=(n, const))\n",
"answer = W[0]/1000 # work output in kJ\n",
"print(\"The work done during process, W = %1.2f kJ \" %answer)\n",
"\n",
"\n",
"import check_lab01 as p\n",
"p.check_p01(answer)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"P2. Consider a heat engine cycle in Figure 3. Heat engine is a system that converts heat or thermal energy to mechanical work.\n",
"For the cycle in Figure 3, $V_1= 0.1 m^3$, $p1 = 3 bar$ , $V_2= 0.3 m^3$ $p3 = 1 bar$\n",
"\n",
"<center><img src=\"./figure_03.svg\" alt=\"Drawing\" style=\"width: 300px;\"/> </center>\n",
"<center>Figure 3: p-V diagram of a cycle </center>\n",
"\n",
"What is the net work outout from the cycle ?"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"39.99999999999999\n",
"The work done during cycle, W = 40.00 kJ \n",
"Nice work!\n"
]
},
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# enter your work here\n",
"p1 = 3 # bar\n",
"V1 = 0.1 #m^3\n",
"p3 = 1 # bar\n",
"V2 = 0.3#m^3\n",
"\n",
"answer = ((p1*10**5*(V2-V1))+(p3*10**5*(V1-V2)))/1000. # area under the p-V curve\n",
"print(answer) # total work in kJ\n",
"print(\"The work done during cycle, W = %1.2f kJ \" %(answer))\n",
"\n",
"import check_lab01 as p\n",
"p.check_p02(answer)\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Procedure \n",
"\n",
"The procedure and details of the experiment are included in a lab-handout [3].\n",
"\n",
"[ME3264_Lab_1_Heat_Engine.pdf](https://drive.google.com/file/d/1Rs5Y2JRM6zzzr3pvoqTJID6fvxpyuCTx/view?usp=sharing)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Notes on error propagation\n",
"\n",
"The theory of error analysis gives a general formula for the uncertainty when a result is found by a calculation from a collection of measurements [4],. The formula is based on the idea of a first-order Taylor series expansion of functions of many variables. For a well behaved function $f(x,y,z,...)$\n",
"of the completely independent physical variables $x,y,z,...$ which have uncertainties $,\\sigma_x,\\sigma_y,\\sigma_z,...$ then the uncertainty in the value of the result $\\sigma_f$ is given by the formula:\n",
"\n",
"$\\sigma_f^2 = (\\frac{\\partial{f}}{\\partial x})^2\\sigma_x^2 + (\\frac{\\partial{f}}{\\partial y})^2\\sigma_y^2 + (\\frac{\\partial{f}}{\\partial z})^2\\sigma_z^2$ (9)\n",
"\n",
"For example, in this experiment, we are using external weights ($mg$) to compress volume of gas in the cylinder by height $h$. Work done by the force is:\n",
"\n",
"$W = mgh$ (10)\n",
"\n",
"where, $g$ is the gravitational accleration. Using Eq(9), the $\\sigma_W$ is obtained as:\n",
"\n",
"$\\sigma_W^2 = (\\frac{\\partial{W}}{\\partial m})^2\\sigma_m^2 + (\\frac{\\partial{g}}{\\partial y})^2\\sigma_g^2 + (\\frac{\\partial{W}}{\\partial h})^2\\sigma_h^2$ (11)\n",
"\n",
"\n",
"Note : \n",
"\n",
"- In Eq (10), for constant g , $\\sigma_g = 0$\n",
"- If the estimate of uncertainty of variable is unavailabe during the experiment, typically, the minimum uncertainty of a single measurement can be approximated with the value of the least significant digit (least-count) of the measurementdisplay. [\\[5\\]](http://www.phys.lsu.edu/classes/phys2108/2108_measA.pdf)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## References \n",
"1. [First law of thermodynamics, Wikipedia](https://en.wikipedia.org/wiki/First_law_of_thermodynamics).\n",
"2. M.J. Moran and H.N. Shapiro, Fundamentals of Engineering Thermodynamics, Eighth Edition, Chapter 2.\n",
"3. ME3264 Lab1 - Heat Engine, Prof. Bryan W. Weber (Spring 2020)\n",
"4. [Notes on measurement uncertainties](https://drive.google.com/file/d/1WBDkb-9fM6Y-wmQF3pl28JAt8JReiKJl/view?usp=sharing)\n",
"5. [Introduction to Measurement and Data Analysis Notes](http://www.phys.lsu.edu/classes/phys2108/2108_measA.pdf)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}