2. Introduction to EES
• EES (pronounced ’ease’): “Engineering Equation Solver”
• Developed by S.A. Klein and G.F. Nellis at University of
Wisconsin–Madison.
• Licensed and distributed by F-Chart software
(http://fchart.com)
• Demo version can be acquired free from
http://fchart.com/ees/demo.php
• Licensing and ordering information can obtained from
http://fchart.com/ees/ and http://fchart.com/ees/order.php
• Single user license fee: $600-$1200
2naveedurrehman.com
3. Salient features
• Support non-sequential codes (or equations)
• Support sequential programming language (as in C,
MATLAB, Pascal and FORTRAN etc. including
conditioning, looping and functional approaches etc.)
• Built-in mathematical functions (e.g. PVT diagrams,
Moody, Heat exchanger etc.)
• Built-in Thermo-physical property functions (e.g. for
steam, refrigerants, air, gases etc.)
• Support display of results in several visual formats (e.g.
graphs, contours, diagrams etc.)
3naveedurrehman.com
7. Application areas
Following are the few application areas and courses where
EES can be utilized:
• Thermodynamics
• Engineering mechanics
• Fluid mechanics
• Heat transfer
• Gas dynamics
• IC Engines
• Steam and gas turbines
• Refrigeration & air conditioning
• Renewable energy technologies
• Final Year Project
7naveedurrehman.com
12. Solving system of equations
Try:
X + Y = 10
X - 2*Y = 5
12
X + Y + Z = 10
X - 2*Y = 5
X + Z = 4
X + Y + Z = 10
X + Y = 0
What about this:
Remember, number of variables = number of equations!
ERROR!
naveedurrehman.com
13. Solving system of equations
Try:
V = pi * (R^2) * H
R = 10
H = 12
13
Calculate volume of cylinder where radius is 10 m and
height = 12 m (using 𝑉 = 𝜋𝑅2 𝐻)
Calculate height of cylinder where radius is 10 m and
volume = 3000 m3 (using 𝑉 = 𝜋𝑅2 𝐻)
V = pi * (R^2) * H
R = 10
V = 3000
naveedurrehman.com
14. Solving system of equations
Try:
R = G + 2
G = 2 * B
B = 3
14
Diameter of red ball is 2” more than that of green ball.
While the diameter of green ball is twice than that of blue
ball. If the diameter of blue ball is 3”, calculate diameters of
other two balls.
Codes:
naveedurrehman.com
16. Engineering units
Try:
16
T = 30 [C]
A = 40 [m^2]
To insert a unit from list,
right-click editor, select
“Units list”. After selecting
unit from list, click “Paste”.
naveedurrehman.com
17. Units consistency check
Try:
T = 30 [C]
A = 40 [m^2]
U = T+A
17
To check consistency of units:
[Menu] Calculate > Check units
or
Press “F8” key
naveedurrehman.com
18. Units consistency check
Try:
T = 30 [C]
A = 40 [m^2]
U = T * A
18
Consistency check:
Right-click equation and select “Set
variable Units”. Input the valid unit
(C*m^2) for U and click “Ok”.
naveedurrehman.com
19. Units conversion
Try:
A = 30*Convert(ft,m)
B = 10*Convert(MJ, kJ)
C = 100*Convert(kJ/kg,BTU/lbm)
19
Solution:
Note: Unit to each variable is automatically assigned.
Convert statement is used to do unit conversion:
Convert ( from-unit , to-unit )
naveedurrehman.com
20. Converting temperature units
Try:
TheF = ConvertTEMP(C,F,30) "Convert 30 deg. C to deg. F"
TheC = ConvertTEMP(F,C,100) "Convert 100 deg. F to deg. C"
20
Solution:
ConvertTemp statement is used to do unit conversion
between degree centigrade (°C) and Fahrenheit (°F):
ConvertTEMP ( from-unit , to-unit, value)
naveedurrehman.com
21. Formatted equations
Try:
f_c = 100
A =(1/pi^2)/f_c
21
To view formatted equations:
[Menu] Windows > Formatted Equations
or
Press “Ctrl + F” key
naveedurrehman.com
24. Comments
Try:
A = 10 "Area of surface"
W = 4 "!Width of surface"
H = A/W {Height of surface}
C = 400 {!Looks like constant}
24
Formatted equations:
To set color and font style:
[Menu] Options > Preferences > Equations
Set properties for type I and type II comments.
Click “Store” to save your preferences.
Type I comment: “ “ or { }
Type II comment: “! “ or {! }
naveedurrehman.com
25. Bookmarking
Bookmarks are helpful in lengthy programs.
To add a bookmark, use following directive:
$Bookmark …caption…
For example:
$Bookmark COMRPESSOR
To access bookmarks, right-click in editor
and select bookmark from the list given at the
end.
25naveedurrehman.com
26. Variable information
Try:
D ^2=100
J = D + 50
26
To view variable info:
[Menu] Options > Variable Info
or
Press “F9” key
Solution:
naveedurrehman.com
27. Variable information
Try:
D^2=100
J = D + 50
27
Solution constraint:
The value variable D of must
be less than 0.
Do the following settings in Variable info:
Note that, a good guess may speed up processing.
Another purpose of variable info is to replace a particular
variable everywhere in codes. For this, try to rename
variable “D” as “E” and press “Ok”.
naveedurrehman.com
28. Exporting values
28
To export:
$export /A 'filename' var1 var2 ….
Where,
• Flag /A is optional and is used to append contents.
• Filename can have following extensions:
1. csv, tab, dat: these extensions are generally
accepted by most of the software e.g. MATLAB,
EXCEL.
2. txt: this extension will create file which is read-able
by Open Lookup Table command from Tables menu.
If file name is just ‘clipboard’, contents will be copied to
clipboard.
naveedurrehman.com
29. Importing values
29
To import:
$import ‘filename’, var1 var2 ….
Try:
Create a file ‘c:data.txt’ with the following contents:
1000 500 100
Then, solve these codes:
$import 'c:data.txt', a b c
d = a + b + c
Solution:
naveedurrehman.com
30. Constants
30
To add a pre-defined constant:
[Menu] Options > Constants
Select constant from list and click “Paste”.
Try:
mass = 10
weight = mass*g#
Remember, constants are not treated as variables!
For example, in above, there are just two variables i.e.
“mass” and “weight” and hence, this system of equations
has some solution.
Custom constants may be added to the list.
naveedurrehman.com
31. Arrays
31
An array (or vector) is an organized collection of different
values of same variable. Arrays are helpful in batch
processing, making plots, etc.
Try:
T[1]=100 "the first element of the array T"
T[2]=200 "the second element of the array T"
T[3]=300 "the third element of the array T"
In above, the variable “T” is not a scalar variable, but it is
an array (or vector) having values 100, 200 and 300 placed
at index 1, 2 and 3 respectively.
$Arrays ON and $Arrays OFF directive may be used to
switch the display of Arrays window.
naveedurrehman.com
33. Duplicate statement
33
Duplicate statement provides a convenient method for
carrying out similar operations on multiple elements of an
array.
Duplicate index = start,stop
equation(s) to be duplicated
End
duplicate i=1,4
T[i]=i
end
Try: Arrays Table:
naveedurrehman.com
34. Duplicate statement
34
Try:
For the 10 points of “X”, the value of “Y” is “X^2+10”. Using
duplicate statement, generate array table for X and Y such
that:
duplicate i=1,10
Y[i] = i^2 + 10
X[i]=i
end
Solution::
Hint: Both X and Y are vectors. A
scalar variable as iterator may be
used in duplicate statement.
naveedurrehman.com
35. 2D plots
35
To draw plot:
[Menu] Plots > Now Plot Window > X-Y Plot
Select variables for X and Y axis and click “Ok”.
Try:
Draw X-Y plot for
previous example.
naveedurrehman.com
36. 3D plots
36
To draw plot:
[Menu] Plots > Now Plot Window > X-Y-Z Plot
Select variables for X, Y and Z axis, opt “3-D Plot” and click
“Ok”.
Try:
Draw plot for the
following:
duplicate i=1,10
X[i]=i
Y[i] = i + 1
Z[i] = i
end
naveedurrehman.com
37. Lookup tables
37
Lookup Tables provide a convenient method of saving and
accessing tabular data, useful for interpolation and curve
fitting.
To add a lookup table:
[Menu] Tables > New Lookup Table
• Suggest suitable title. This will be used while retrieving values.
• Select number of rows and columns required in table.
• Data can be entered manually or can be copy-pasted from
MATLAB, EXCEL etc.
• Lookup tables can be exported to a file for sharing purpose.
• Also, they can be imported from CSV files, a famous export
extension supported by common data loggers.
naveedurrehman.com
38. Lookup tables
38
Try:
Time taken by a metallic
ball when dropped from
different height were
recorded as shown in
table.
Develop a lookup table
titled: “FALL” for this
data.
naveedurrehman.com
39. Interpolation in lookup table
39
Interpolated data can be retrieved from lookup tables using
Interpolate statement.
X = Interpolate('TableName', 'Var1', 'Var2', Var=Val)
Try:
Using lookup table created in previous example:
Ans_1 = Interpolate('FALL','Height','Time',Time=230)
Ans_2 = Interpolate('FALL','Height','Time',Height=45)
Solution:
naveedurrehman.com
40. Other lookup functions
40
• Lookup: Return value at given row and column
X = Lookup('Table',Row,Column)
• LookupRow: Return row#. Value matching in column.
X = LookupRow('Table',Column,Value)
• LookupCol: Return column#. Value matching in row.
X = LookupCol('Table',Row,Value)
• AvgLookup: Return average of values.
X = AvgLookup(‘Table','ColName',[StartRow,StopRow])
• SumLookup: Return average of values.
X = SumLookup(‘Table','ColName',[StartRow,StopRow])
naveedurrehman.com
41. Regression
41
Regression is a useful method to find dependence of one
variable on to other variables.
To find linear regression equation:
[Menu] Tables > Linear Regression
Select dependent variable and independent variable(s).
Click “Fit” to find the fitted equation.
To find statistics regarding fit, click “Stats”.
Polynomial order can be increased and cross-terms may be
added to increase accuracy.
naveedurrehman.com
42. Regression
42
Try:
For the following data, determine 2nd order polynomial of
“TIME” as a function of “HEIGHT” and “VELOCITY”:
naveedurrehman.com
43. Parametric tables
43
Parametric tables are used for parametric studies in which the
effect of one variable (the independent variable) on another
variable (the dependent variable) is studied.
To create parametric table:
Writing codes conventionally in editor and then click:
[Menu] Tables > New Parametric Table
To populate (or solve) a parametric table:
[Menu] Calculate > Solve Table
Or
Press ‘F3’ key.
naveedurrehman.com
45. Parametric tables with a check
45
To check whether the parametric solution is required, use:
$IfNot ParametricTable
…relations…
$EndIf
For example, in previous problem, constant values of L and
R may be given inside codes:
$IfNot ParametricTable
L= 30
R = 50
$EndIf
naveedurrehman.com
46. Functions
46
To access available functions:
[Menu] Options > Function Info
Select function from list and click “Paste”.
naveedurrehman.com
47. Useful math functions
47
• Trigonometric functions:
sin, cos, tan
• Trigonometric inverse functions:
arcsin, arccos, arctan
• Hyperbolic functions:
sinh, cosh, tanh
• Hyperbolic inverse functions:
arcsinh, arccosh, arctanh
• Logarithmic and exponent functions:
ln, log10, exp
• Other functions:
abs, floor,
sum, average, mod, max, min
naveedurrehman.com
48. Useful fluid properties functions
48
• CP and CV: Specific heats at const. pressure and volume
• PRESSURE, TEMPERATURE and VOLUME
• DENSITY: It is also the reciprocal of specific volume
• ENTHALPY, ENTROPY, INTENERGY (Internal energy)
and QUALITY
• P_CRIT, T_CRIT, V_CRIT: Critical properties
• P_SAT and T_SAT: Saturation properties
• T_TRIPLE: Triple point temperature
• PRANDTL: Prandtl number used in heat transfer
• HUMRAT and WETBULB
naveedurrehman.com
49. Useful fluid properties functions
49
Try:
How much amount of heat per kg of water 100 kPa will be
required to rise temperature from 30°C to 80°C?
Solution:
𝑞 = ℎ 𝑇=80℃,𝑃=100𝑘𝑃𝑎 − ℎ 𝑇=30℃,𝑃=100𝑘𝑃𝑎
Codes:
P = 100 [kPa]
T1 = 30 [C]
T2 = 80 [C]
H1 = ENTHALPY(Steam,T=T1,P=P)
H2 = ENTHALPY(Steam,T=T2,P=P)
Q = H2 - H1
2 1
naveedurrehman.com
50. Strings
50
String variables are defined within single-quotes.
For example:
F$ = ‘Some string value’
They can be used in place of fluid name, for example:
F$ = 'Steam'
P = P_CRIT(F$)
mode$ = 'blue'
$if mode$='blue'
x=1
$else
x=0
$endif
They can also be used in switching, for example:
Solve these codes with
mode$ value of ‘blue’
and then ‘red’. Check the
value of variable b in
each case.
naveedurrehman.com
51. Diagram window
51
Diagram Window provides the capability to easily develop a
user-friendly, graphical interface to an EES program.
To open diagram window:
[Menu] Windows > Diagram Window
or
Press ‘Ctrl+D’ key
“Toolbar”
When it is visible, diagram window is in edit
mode. Otherwise, it is in execution mode.
To view toolbar, press ‘Ctrl+D’ again.
naveedurrehman.com
52. Diagram window
52
Try:
In diagram window, ask user to input values of radius (R”)
and length (L”) of a cylinder. Calculate surface area of
cylinder using 𝐴 = 𝜋𝑅2
+ 2𝜋𝑅𝐿
Diagram window: Codes:
$ifnot diagramwindow
R=1
L = 1
$endif
A = pi*R^2 + 2*pi*R*L
naveedurrehman.com
53. Diagram window
53
Try:
In diagram window, ask user to select fluid (Ethanol or
Steam) and then show the critical pressure accordingly.
Hint: Use string list.
Diagram window: Codes:
$ifnot diagramwindow
F$=‘Steam'
$endif
P = P_CRIT(F$)
naveedurrehman.com
54. Subprograms
54
Subprograms help in compartmentalize length codes.
To use a subprogram, first declare and define it one time
and then call it as many times as required. For example:
Declaring and defining a subprogram ‘DOF’:
Subprogram DOF(X : Y, Z) “X=inputs, Y,Z = returns”
X=2*Y+3*Z
X^2=Y^2+Z^2
end
Calling above subprogram two times:
Call DOF(5: B, C)
K=10
Call DOF(K: D, E)
Solution:
naveedurrehman.com
55. Subprograms
55
Try:
Write a subprogram to calculate length of cylinder by
calling in radius and surface area.
“Declaration and definition of subprogram: CylinderLength”
Subprogram CylinderLength(R,A: L)
A = pi*R^2 + 2*pi*R*L
End
“Calls to subprogram: CylinderLength”
Call CylinderLength(2,600:Length_1)
Call CylinderLength(10,9000:Length_2)
naveedurrehman.com
56. Practice problems
56
Problem #1
The admission fee at a small fair is $1.50 for children and
$4.00 for adults. On a certain day, 2200 people enter the
fair and $5050 is collected. How many children and how
many adults attended?
Ans: Adults = 700, Children = 1500
SOLUTION:
c = 1.5 "admission fee for children"
a = 4 "admission fee for adults"
p = 2200 "total number of people entered fair"
t = 5050 "total fee collected"
p = nc + na "nc is number of children and na is number of adults"
t = nc*c + na*a "Done!"
naveedurrehman.com
57. Practice problems
57
Problem #2
Calculate the least distance between following points using
parametric tables feature of EES:
• (0,2) and (10,18)
• (19,9) and (-6,16)
• (-9,0) and (-4,-10)
Distance formula: 𝑑2 = 𝑦2 − 𝑦1
2 + 𝑥2 − 𝑥1
2
Ans: 18.87, 25.96 and 11.18
naveedurrehman.com
58. Practice problems
58
Problem #3
Determine magnitude and direction of resultant force:
Ans: 629.1 N, 67.89°
Solution:
F_Rx = 600*cos(30) - 400*sin(45)
F_Ry = 600*sin(30) + 400*cos(45)
F_R = SQRT(F_Rx^2 + F_Ry^2)
theta = ARCTAN(F_Ry/F_Rx)
naveedurrehman.com
59. Practice problems
59
Problem #4
A piston cylinder device initially contains 0.4m3 of air at 100
kPa and 80°C. The air is now compressed to 0.1m3 in such
a way that the temperature inside the cylinder remains
constant. Determine the work done during this process.
Isothermal work done formula: 𝑃1 𝑉1 ln
𝑉2
𝑉1
Ans: -55.45 kJ
naveedurrehman.com
60. Practice problems
60
Problem #5
Consider a steam power plant operating on the simple ideal
Rankine cycle. Steam enters the turbine at 3MPa and
350°C and is condensed in the condenser at a pressure of
75 kPa. Determine the thermal efficiency of this cycle.
Ans: 26%
naveedurrehman.com