Summary EES Manual PDF
Summary EES Manual PDF
Summary EES Manual PDF
General commands
F1: help file
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.
Options menu Unit system
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 has the following format: Convert(From, To) where From and To are
character strings identifying the unit type such as Btu/hr-ft2-R or mph.
Comments
Array variables X[5,3]
A Lookup file = 2-dimensional matrix
For example:
Specific volume v1=volume(R134a,T=T1,P=P1)
Before solving the equation:
Set guess values and (possibly) the lower and upper bounds for the variables
Options Variable Information
Equation Window:
Checking the syntax using the Check/Format command in the Calculate menu
The first column is the one which will vary (type in or enter automatically by the clicking on
the arrow of the first column)
In the equation window the variable should be added with some code to prevent fixing the
variable to a certain defined value
$ifnot Parameter Table
P2 = 300
$ endif
Solve
Plots of the thermodynamic properties can be generated using the Property Plot command
Example:
Type: T-s diagram R245fa
Reference: DFT (IIR, if you work with REFprop for mixtures; REFprop must be imported via
package)
Optimization
Min/Max: to find the minimum or maximum of an undetermined variable in an equation set for
which there is one or more (limited to 10) degrees of freedom.
Methods: The recursive Quadratic Approximations method is usually faster, but the Golden
Section method is more reliable. Multi-dimensional optimization may be done using either Direct
Search or a Variable Metric algorithm. The Variable Metric method, which uses numerical
derivatives, usually performs much better than the Direct Search method, but it may be confounded
if the optimum is constrained to be on a bound.
Careful selection of the bounds and the guess value(s) of the independent variables will improve
the likelihood of finding an optimum.
Min/Max Table provides the same capability as the Min/Max command, except that the
calculations will be repeated for each row in the Parametric Table.
Update Guesses replaces the guess value of each variable in the Equations window with the value
determined in the last calculation. This command is accessible after calculations have been
successfully completed.
Built-in functions
Mathematical functions
From page 91 in Manual
if (A, B, X, Y, Z)
allows conditional assignment statements.
If A<B; the function will return a value equal to the value supplied for X;
If A=B, the function will return the value of Y;
If A>B, the function will return the value of Z.
lookup(Filename, Row, Column)
Returns the value in the Lookup Table or Lookup file at the specified row and column.
A function is a subprogram that accepts one or more inputs and returns a single result.
A procedure can return one or more results.
A module is similar to a procedure in that it can return one or more results. However, it
differs from a procedure in that it employs equalities rather than assignment statements.
Functions
At the top of the Equations Window
An assignment statement sets the variable identified on the left of the statement to the
numerical value on the right.
FUNCTION function name(argument1, argument2,)
X:=X+1 is a valid assignment statement but it obviously cannot be an equality
END
If then else, repeat until and goto statements may be used
Example
The specific availability of a flowing stream, often called , is
= (h - ho) - To (s - so) + V2/2 + g z
Once the temperature and pressure of the dead state are selected, ho and so are constants. A user
function for the availability of steam, with To=530 R and Po=1 atm, could be implemented by placing
the following statements at the top of the Equations window. A reference to psi(T1, P1, V1, Z1) from
an equation would return the specific availability of steam in Btu/lbm for the chosen dead state.
FUNCTION psi(T, P, V, Z)
To := 530
R dead state temperature
ho := 38.05
Btu/lbm specific enthalpy at dead state conditions
so := 0.0745
Btu/lbm-R specific entropy at dead state conditions
h := enthalpy(STEAM, T=T, P=P)
s := entropy(STEAM, T=T, P=P)
g = 32.17 ft/s^2 gravitational acceleration
psi := (h-ho)- To * (s so) + (V^2 / 2 + g * Z) * Convert(ft^2/s^2, Btu/lbm)
END
Procedures
EES procedures are very much like EES functions, except that they allow multiple outputs.
At the top of the Equations Window
The format of a Procedure is:
PROCEDURE procedure name(input1, input2, : output1, output2,)
...
...
X :=...
Y :=...
END
To use the procedure, place a CALL statement anywhere within your equations. The CALL
statement appears as
...
CALL test(1,2,3 : X,Y)
...
If then else, repeat until and goto statements may be used
Only in functions and procedures (not in modules and in the main body text).
Recognized operators are =, <, >, <=, >=, and <> (for not equal).
The AND and OR logical operators can also be used in the conditional test.
The single-line format has the following form:
If (Conditional Test ) Then Statement 1 Else Statement 2
Example:
Function MIN3(x,y,z) { returns smallest of the three values}
If (x<y) Then m:=x Else m:=y
If (m>z) Then m:=z
MIN3:=m
End
Y = MIN3(5,4,6) { Y will be set to 4 when this statement executes}
{nested If statement}
GoTo Statements
EES will normally process the assignment statements in a function or procedure in the order
they appear starting with the first statement. However, the flow control can be altered using
GoTo statements.
The format of a GoTo statement is simply GoTo # where # is a statement label number which
must be an integer number between 1 and 30000.
Statement labels precede an assignment statement separated with a colon (:).
Example:
Function FACTORIAL(N)
F:=1
i:=1
10: i:=i+1
F:=F*i
If (i<N) Then GoTo 10
FACTORIAL:=F
End
Y= FACTORIAL(5) { Y will be set to 120 when this statement executes}
Modules
Example:
Library Files
EES allows files containing one or more functions, procedures or modules (subprograms) to
be saved as Library files. A Library file has a .LIB filename extension.
Advanced Features
String Variables
Examples:
A$=carbon dioxide
B$=A$
h=enthalpy(R$,T=T,P=P)
String variables may be used with the Parametric table.