Engineering equation solver for microsoft windows operating systems - commercial and professional versions

  • 249 trang
  • file .pdf
EES
Engineering Equation Solver
for Microsoft Windows
Operating Systems
Commercial and Professional Versions
F F-Chart Software
C
http://www.fchart.com/
email : [email protected]
Copyright 1992-2001 by S.A. Klein
All rights reserved.
The authors make no guarantee that the program is free from errors or that the results
produced with it will be free of errors and assume no responsibility or liability for the
accuracy of the program or for the results that may come from its use.
EES was compiled with DELPHI 5 by Borland
Registration Number__________________________
ALL CORRESPONDENCE MUST INCLUDE THE REGISTRATION
NUMBER
V6.160
EES
Engineering Equation Solver
for Microsoft Windows
Operating Systems
F F-Chart Software
C
http://www.fchart.com/
email : [email protected]
Table of Contents
Overview ............................................................................................................. 1
Chapter 1: Getting Started ........................................................................... 5
Installing EES on your Computer................................................................. 5
Starting EES ................................................................................................. 5
Background Information............................................................................... 6
An Example Thermodynamics Problem....................................................... 9
Chapter 2: EES Windows ........................................................................... 19
General Information .................................................................................. 19
Equations Window ..................................................................................... 21
Formatted Equations Window .................................................................... 24
Solution Window........................................................................................ 27
Arrays Window........................................................................................... 29
Residuals Window...................................................................................... 31
Parametric Table Window .......................................................................... 33
Lookup Table Window............................................................................... 37
Diagram Window ....................................................................................... 39
Plot Window ............................................................................................... 51
Debug Window........................................................................................... 59
Chapter 3: Menu Commands .................................................................... 63
The File Menu ............................................................................................ 63
The Edit Menu ........................................................................................... 73
The Search Menu ....................................................................................... 77
The Options Menu ..................................................................................... 70
The Calculate Menu .................................................................................. 93
The Tables Menu ....................................................................................... 99
The Plot Menu.......................................................................................... 107
The Windows Menu................................................................................. 117
The Help Menu ........................................................................................ 119
The Textbook Menu ................................................................................ 120
Chapter 4: Built-in Functions ...................................................................... 123
Mathematical Functions . ......................................................................... 123
String Functions........................................................................................ 132
Thermophysical Property Functions......................................................... 134
Using Lookup Files and the Lookup Table .............................................. 143
The $OpenLookup and $SaveLookup Directives .................................... 151
ii
Chapter 5: EES Modules, Functions and Procedures .......................... 153
EES Functions . ........................................................................................ 154
EES Procedures ........................................................................................ 156
Single-Line If Then Else Statements ........................................................ 158
Multiple-Line If Then Else Statements .................................................... 159
GoTo and Repeat-Until Statements .......................................................... 160
Error Procedure......................................................................................... 161
Warning Procedure ................................................................................... 162
Modules and Subprograms ....................................................................... 163
Library Files ............................................................................................. 166
$COMMON Directive .............................................................................. 169
The $INCLUDE directive ........................................................................ 170
The $EXPORT directive .......................................................................... 171
The $IMPORT directive ........................................................................... 172
Chapter 6: Compiled Functions and Procedures .................................... 173
EES Compiled Functions (.DLF Files)..................................................... 173
The PWF Example Compiled Function.................................................... 176
EES Compiled Procedures (.FDL and .DLP Files) .................................. 179
Compiled Procedures with the .FDL Format - a FORTRAN Example.... 180
Compiled Procedures with the .DLP Format - a Pascal Example ............ 183
Multiple Files in a Single Dynamic Link Library (.DLL) ....................... 185
Help for Compiled Routines..................................................................... 187
Chapter 7: Advanced Features ..................................................................... 189
String Variables ........................................................................................ 189
Complex Variables ................................................................................... 190
Array Variables......................................................................................... 194
The DUPLICATE Command ................................................................... 196
Matrix Capabilities ................................................................................... 197
Using the Property Plot............................................................................. 199
Integration and Differential Equations ..................................................... 200
Creating and Using Macro Files ............................................................... 211
Appendix A: Hints for Using EES .............................................................. 219
Appendix B: Numerical Methods used in EES........................................ 223
Solution to Algebraic Equations............................................................... 223
Blocking Equation Sets ............................................................................ 226
Determination of Minimum or Maximum Values.................................... 228
Numerical Integration............................................................................... 229
References for Numerical Methods .......................................................... 231
Appendix C: Adding Property Data to EES ............................................. 233
Appendix D: Example Problem Information ........................................... 243
-iii-
__________________________________________________________________________
Overview
__________________________________________________________________________
EES (pronounced 'ease') is an acronym for Engineering Equation Solver. The basic function
provided by EES is the solution of a set of algebraic equations. EES can also solve
differential equations, equations with complex variables, do optimization, provide linear and
non-linear regression and generate publication-quality plots. Versions of EES have been
developed for Apple Macintosh computers and for the Windows operating systems. This
manual describes the version of EES developed for Microsoft Windows operating systems,
including Windows 95/98/2000 and Windows NT 4.
There are two major differences between EES and existing numerical equation-solving
programs. First, EES automatically identifies and groups equations which must be solved
simultaneously. This feature simplifies the process for the user and ensures that the solver
will always operate at optimum efficiency. Second, EES provides many built-in
mathematical and thermophysical property functions useful for engineering calculations.
For example, the steam tables are implemented such that any thermodynamic property can
be obtained from a built-in function call in terms of any two other properties. Similar
capability is provided for most organic refrigerants (including some of the new blends),
ammonia, methane, carbon dioxide and many other fluids. Air tables are built-in, as are
psychrometric functions and JANAF table data for many common gases. Transport
properties are also provided for most of these substances.
The library of mathematical and thermophysical property functions in EES is extensive, but
it is not possible to anticipate every user's need. EES allows the user to enter his or her own
functional relationships in three ways. First, a facility for entering and interpolating tabular
data is provided so that tabular data can be directly used in the solution of the equation set.
Second, the EES language supports user-written functions and procedure similar to those in
Pascal and FORTRAN. EES also provides support for user-written modules, which are self-
contained EES programs that can be accessed by other EES programs. The functions,
procedures, and modules can be saved as library files which are automatically read in when
EES is started. Third, compiled functions and procedures, written in a high-level language
such as Pascal, C or FORTRAN, can be dynamically-linked into EES using the dynamic
link library capability incorporated into the Windows operating system. These three
methods of adding functional relationships provide very powerful means of extending the
capabilities of EES.
1
The motivation for EES rose out of experience in teaching mechanical engineering
thermodynamics and heat transfer. To learn the material in these courses, it is necessary for
the student to work problems. However, much of the time and effort required to solve
problems results from looking up property information and solving the appropriate
equations. Once the student is familiar with the use of property tables, further use of the
tables does not contribute to the student's grasp of the subject; nor does algebra. The time
and effort required to do problems in the conventional manner may actually detract from
learning of the subject matter by forcing the student to be concerned with the order in which
the equations should be solved (which really does not matter) and by making parametric
studies too laborious. Interesting practical problems that may have implicit solutions, such
as those involving both thermodynamic and heat transfer considerations, are often not
assigned because of their mathematical complexity. EES allows the user to concentrate
more on design by freeing him or her from mundane chores.
EES is particularly useful for design problems in which the effects of one or more
parameters need to be determined. The program provides this capability with its Parametric
Table, which is similar to a spreadsheet. The user identifies the variables that are
independent by entering their values in the table cells. EES will calculate the values of the
dependent variables in the table. The relationship of the variables in the table can then be
displayed in publication-quality plots. EES also provides capability to propagate the
uncertainty of experimental data to provide uncertainty estimates of calculated variables.
With EES, it is no more difficult to do design problems than it is to solve a problem for a
fixed set of independent variables.
EES offers the advantages of a simple set of intuitive commands that a novice can quickly
learn to use for solving any algebraic problems. However, the capabilities of this program
are extensive and useful to an expert as well. The large data bank of thermodynamic and
transport properties built into EES is helpful in solving problems in thermodynamics, fluid
mechanics, and heat transfer. EES can be used for many engineering applications; it is
ideally suited for instruction in mechanical engineering courses and for the practicing
engineer faced with the need for solving practical problems.
The remainder of this manual is organized into seven chapters and five appendices. A new
user should read Chapter 1 which illustrates the solution of a simple problem from start to
finish. Chapter 2 provides specific information on the various functions and controls in each
of the EES windows. Chapter 3 is a reference section that provides detailed information for
each menu command. Chapter 4 describes the built-in mathematical and thermophysical
property functions and the use of the Lookup Table for entering tabular data. Chapter 5
provides instructions for writing EES functions, procedures and modules and saving them in
2
Library files. Chapter 6 describes how compiled functions and procedures, written as
Windows dynamic-link library (DLL) routines, can be integrated with EES. Chapter 7
describes a number of advanced features in EES such as the use of string, complex and array
variables, the solution of simultaneous differential and algebraic equations, and property
plots. Appendix A contains a short list of suggestions. Appendix B describes the numerical
methods used by EES. Appendix C shows how additional property data may be
incorporated into EES. A number of example problems are provided in the Examples
subdirectory included with EES. Appendix D indicates which features are illustrated in the
example problems provided with EES.
3
4
CHAPTER1
__________________________________________________________________________
Getting Started
__________________________________________________________________________
Installing EES on your Computer
EES is distributed in a self-installing compressed form in a file called SETUP_EES.exe
which may be provided on two floppy disks or on a CD. To install EES, it is necessary
execute the SETUP_EES installation program. If you are installing EES from a CD, the
installation program will start automatically when the CD is placed in the drive. To install
EES from a floppy disk, place the first disk in the drive and select the Run command from
the Start menu and then enter A:\SETUP_EES.exe.
Here A: is your floppy drive designation. In either case, the installation program will
provide a series of prompts which will lead you through the complete installation of the EES
program.
Starting EES
The default installation program will create a directory named C:\EES32 in which the EES
files are placed. The EES program icon shown above will identify both the program and
EES files. Double-clicking the left mouse button on the EES program or file icon will start
the program. If you double-clicked on an EES file, that file will be automatically loaded.
Otherwise, EES will load the HELLO.EES file which briefly describes the new features in
your version. You can delete or rename the HELLO.EES file if you do not wish to have it
appear when the program is started.
5
Chapter 1 Getting Started
Background Information
EES begins by displaying a dialog window that shows registration information, the version
number and other information. The version number and registration information will be
needed if you request technical support. Click the OK button to dismiss the dialog window.
Detailed help is available at any point in EES. Pressing the F1 key will bring up a Help
window relating to the foremost window. Clicking the Contents button will present the Help
index shown below. Clicking on an underlined word (shown in green on color monitors)
will provide help relating to that subject.
6
Getting Started Chapter 1
EES commands are distributed among nine pull-down menus. (A tenth user-defined menu
can be placed to the right of the Help menu. See the discussion of the Load Textbook
command File menu in Chapter 3.) A brief summary of their functions follows. Detailed
descriptions of the commands appear in Chapter 3.
Note the a toolbar is provided below the menu bar. The toolbar contains small buttons
which provide rapid access to many of the most frequently used EES menu commands. If
you move the cursor over a button and wait for a few second, a few words will appear to
explain the function of that button. The toolbar can be hidden, if you wish, with a control in
the Preferences dialog (Options menu).
The System menu represented by the EES icon appears above the file menu. The System
menu is not part of EES, but rather a feature of the Windows Operating System. It holds
commands that allow window moving, resizing, and switching to other applications.
The File menu provides commands for loading, merging and saving work files and libraries,
and printing.
The Edit menu provides the editing commands to cut, copy, and paste information.
The Search menu provides Find and Replace commands for use in the Equations window.
The Options menu provides commands for setting the guess values and bounds of variables,
the unit system, default information, and program preferences. A command is also
provided for displaying information on built-in and user-supplied functions.
The Calculate menu contains the commands to check, format and solve the equation set.
The Tables menu contains commands to set up and alter the contents of the Parametric and
Lookup Tables and to do linear regression on the data in these tables. The Parametric
Table, similar to a spreadsheet, allows the equation set to be solved repeatedly while
varying the values of one or more variables. The Lookup table holds user-supplied data
which can be interpolated and used in the solution of the equation set.
The Plot menu provides commands to modify an existing plot or prepare a new plot of data
in the Parametric, Lookup, or Array tables. Curve-fitting capability is also provided.
The Windows menu provides a convenient method of bringing any of the EES windows to
the front or to organize the windows.
The Help menu provides commands for accessing the online help documentation.
7
Chapter 1 Getting Started
The basic capability provided by EES is the solution of a set of non-linear algebraic
equations. To demonstrate this capability, start EES and enter this simple example problem
in the Equations window. Note that EES makes no distinction between upper and lower
case letters and the ^ sign (or **) is used to signify raising to a power.
If you wish, you may view the equations in mathematical notation by selecting the Formatted
Equations command from the Windows menu.
Select the Solve command from the Calculate menu. A dialog window will appear indicating
the progress of the solution. When the calculations are completed, the button changes from
Abort to Continue.
Click the Continue button. The solution to this equation set will then be displayed.
8
Getting Started Chapter 1
An Example Thermodynamics Problem
A simple thermodynamics problem will be set up and solved in this section to illustrate the
property function access and equation solving capability of EES. The problem, typical of
that which may be encountered in an undergraduate thermodynamics course, is as follows.
Refrigerant-134a enters a valve at 700 kPa, 50°C with a velocity of 15 m/s. At the exit of the
valve, the pressure is 300 kPa. The inlet and outlet fluid areas are both 0.0110 m2.
Determine the temperature, mass flow rate and velocity at the valve exit.
State 1 State 2
T = 50°C T=?
P = 700 P = 300 kPa
Vel = 15 m/s Vel = ?
To solve this problem, it is necessary to choose a system and then apply mass and energy
balances. The system is the valve. The mass flow is steady, so that the mass balance is:
m1 = m2 (1)
where
m1 = A1 Vel1 / v1 (2)
m1 = A2 Vel2 / v2 (3)
m = mass flowrate [kg/s]
A = cross-sectional area [m2]
Vel = velocity [m/s]
v = specific volume [m3/kg]
We know that
A1 = A2 (4)
The valve is assumed to be well-insulated with no moving parts. The heat and work effects
are both zero. A steady-state energy balance on the valve is:
 Vel12   Vel22 
" 1  h1 +
m =m
" 2  h2 +  (5)
 2   2 
where h is the specific enthalpy and Vel2/2 is the specific kinetic energy. In SI units,
specific enthalpy normally has units of [kJ/kg] so some units conversions may be needed.
EES provides unit conversion capabilities with the CONVERT function as documented in
Chapter 4. In addition, the Check Units command (Calculate menu) can be applied to
9
Chapter 1 Getting Started
determine check that all unit conversions have been made and the units in each equation are
dimensionally consistent.
From relationships between the properties of R134a:
v1 = v (T1 , P1 ) (6)
h1 = h (T1 , P1 ) (7)
v2 = v (T2 , P2 ) (8)
h2 = h (T2 , P2 ) (9)
Ordinarily, the terms containing velocity are neglected, primarily because the kinetic energy
effects are usually small and also because these terms make the problem difficult to solve.
However, with EES, the computational difficulty is not a factor. The user can solve the
problem with the kinetic energy terms and judge their importance.
The values of T1, P1, A1, Vel11 and P2 are known. There are nine unknowns: A2, m1 , m2 ,
Vel2, h1, v1, h2, v2, T2. Since there are 9 equations, the solution to the problem is defined. It
is now only necessary to solve the equations. This is where EES can help.
Start EES and select the New command from the File menu. A blank Equations window will
appear. Before entering the equations, however, set the unit system for the built-in
thermophysical properties functions. To view or change the unit system, select Unit System
from the Options menu.
EES is initially configured to be in SI units with T in °C, P in kPa, and specific property
values in their customary units on a mass basis. These defaults may have been changed
during a previous use. Click on the controls to set the units as shown above. Click the OK
button (or press the Return key) to accept the unit system settings.
10
Getting Started Chapter 1
The equations can now be entered into the Equations window. Text is entered in the same
manner as for any word processor. Formatting rules are as follows:
1. Upper and lower case letters are not distinguished. EES will (optionally) change the
case of all variables to match the manner in which they first appear.
2. Blank lines and spaces may be entered as desired since they are ignored.
3. Comments must be enclosed within braces { } or within quote marks " ". Comments
may span as many lines as needed. Comments within braces may be nested in which
case only the outermost set of { } are recognized. Comments within quotes will also
be displayed in the Formatted Equations window.
4. Variable names must start with a letter and consist of any keyboard characters except ( )
‘ | * / + - ^ { } : " or ;. Array variables (Chapter 7) are identified with square braces
around the array index or indices, e.g., X[5,3]. String variables (Chapter 7) are
identified with a $ as the last character in the variable name. The maximum length of a
variable name is 30 characters.
5. Multiple equations may be entered on one line if they are separated by a semi-colon (;)1.
The maximum line length is 255 characters.
6. The caret symbol ^ or ** is used to indicate raising to a power.
7. The order in which the equations are entered does not matter.
8. The position of knowns and unknowns in the equation does not matter.
After entering the equations for this problem and (optionally) checking the syntax using the
Check/Format command in the Calculate menu, the Equations window will appear as shown.
Comments are normally displayed in blue on a color monitor. Other formatting options are
set with the Preferences command in the Options menu.
1
If a comma is selected as the Decimal Symbol in the Windows Regional Settings Control Panel, EES will
recognize the comma (rather than a decimal point) as a decimal separator, the semicolon (rather than the comma) as
an argument separator, and the colon : (rather than the semicolon) as the equation separator.
11
Chapter 1 Getting Started
Note the use of the Convert function in this example to convert the units of the specific
kinetic energy [m^2/s^2] to the units used for specific enthalpy [kJ/kg]. The Convert
function is most useful in these problems. See Chapter 4 for a detailed description of its use.
The thermodynamic property functions, such as enthalpy and volume require a special
format. The first argument of the function is the substance name, R134a in this case. The
following arguments are the independent variables preceded by a single identifying letter
and an equal sign. Allowable letters are T, P, H, U, S, V, and X, corresponding to
temperature, pressure, specific enthalpy, specific internal energy, specific entropy, specific
volume, and quality. (For psychrometric functions, additional allowable letters are W, R, D,
and B, corresponding to humidity ratio, relative humidity, dewpoint temperature, and
wetbulb temperature.)
An easy way to enter functions, without needing to recall the format, is to use the Function
Information command in the Options menu. This command will bring up the dialog window
shown below. Click on the ‘Thermophysical properties’ radio button. The list of built-in
thermophysical property function will appear on the left with the list of substances on the
right. Select the property function by clicking on its name, using the scroll bar, if necessary,
to bring it into view. Select a substance in the same manner. An example of the function
showing the format will appear in the Example rectangle at the bottom. The information in
the rectangle may be changed, if needed. Clicking the Paste button will copy the Example
into the Equations window at the cursor position. Additional information is available by
clicking the Function Info and Fluid Info buttons.
12
Getting Started Chapter 1
It is usually a good idea to set the guess values and (possibly) the lower and upper bounds
for the variables before attempting to solve the equations. This is done with the Variable
Information command in the Options menu. Before displaying the Variable Information
dialog, EES checks syntax and compiles newly entered and/or changed equations, and then
solves all equations with one unknown. The Variable Information dialog will then appear.
The Variable Information dialog contains a line for each variable appearing in the Equations
window. By default, each variable has a guess value of 1.0 with lower and upper bounds of
negative and positive infinity. (The lower and upper bounds are shown in italics if EES has
previously calculated the value of the variable. In this case, the Guess value column
displays the calculated value. These italicized values may still be edited, which will force
EES to recalculate the value of that variable.)
The A in the Display options column indicates that EES will automatically determine the
display format for numerical value of the variable when it is displayed in the Solution
window. In this case, EES will select an appropriate number of digits, so the digits column
to the right of the A is disabled. Automatic formatting is the default. Alternative display
options are F (for fixed number of digits to the right of the decimal point) and E (for
exponential format). The display and other defaults can easily be changed with the Default
Information command in the Options menu, discussed in Chapter 3. The third Display options
column controls the hilighting effects such as normal (default), bold, boxed. The units of
the variables can be specified, if desired. The units will be displayed with the variable in the
Solution window and/or in the Parametric Table. EES does not automatically do unit
conversions but it can provide unit conversions using the Convert function (Chapter 4) and
13
Chapter 1 Getting Started
unit checking with the Check Units command in the Calculate menu. The units
information entered here is only for display purposes.
With nonlinear equations, it is sometimes necessary to provide reasonable guess values and
bounds in order to determine the desired solution. (It is not necessary for this problem.)
The bounds of some variables are known from the physics of the problem. In the example
problem, the enthalpy at the outlet, h2, should be reasonably close to the value of h1. Set its
guess value to 100 and its lower bound to 0. Set the guess value of the outlet specific
volume, v2, to 0.1 and its lower bound to 0. Scroll the variable information list to bring
Vel2 into view. The lower bound of Vel2 should also be zero.
To solve the equation set, select the Solve command from the Calculate menu. An
information dialog will appear indicating the elapsed time, maximum residual (i.e., the
difference between the left-hand side and right-hand side of an equation) and the maximum
change in the values of the variables since the last iteration. When the calculations are
completed, EES displays the total number of equations in the problem and the number of
blocks. A block is a subset of equations that can be solved independently. EES
automatically blocks the equation set, whenever possible, to improve the calculation
efficiency, as described in Appendix B. When the calculations are completed, the button
will change from Abort to Continue.
By default, the calculations are stopped when 100 iterations have occurred, the elapsed time
exceeds 60 sec, the maximum residual is less than 10-6 or the maximum variable change is
less than 10-9. These defaults can be changed with the Stop Criteria command in the Options
menu. If the maximum residual is larger than the value set for the stopping criteria, the
equations were not correctly solved, possibly because the bounds on one or more variables
constrained the solution. Clicking the Continue button will remove the information dialog
and display the Solution window shown on the next page. The problem is now completed
since the values of T2, m2, and Vel2 are determined.
14