0% found this document useful (0 votes)
19 views107 pages

Mastering-EES-Chapter1

The document is a comprehensive guide to the Engineering Equation Solver (EES) software, detailing its installation, features, and functionalities. It covers topics such as entering equations, parametric tables, plotting, units, and debugging techniques. Additionally, it includes sections on optimization and numerical integration, providing a thorough resource for users to master EES.

Uploaded by

8826063
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views107 pages

Mastering-EES-Chapter1

The document is a comprehensive guide to the Engineering Equation Solver (EES) software, detailing its installation, features, and functionalities. It covers topics such as entering equations, parametric tables, plotting, units, and debugging techniques. Additionally, it includes sections on optimization and numerical integration, providing a thorough resource for users to master EES.

Uploaded by

8826063
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 107

Mastering EES

Sanford Klein and Gregory Nellis


x 104
5
Spatial temperature gradient (K/m)

4 x=0.25 cm

3 x=0.5 cm

x=0.75 cm

2 x=1.0 cm
x=1.5 cm

1 x=2.0 cm

0
0 25 50 75 100 125 150
Time (s)

400

380
10 MPa
360 8 MPa
Temperature (K)

6 MPa
340 4 MPa

320

300

280

260
-1750 -1500 -1250 -1000 -750 -500
Specific entropy (J/kg-K)
© S.A. Klein and G.F. Nellis, 2012-21

ALL RIGHTS RESERVED. This book contains material protected under


International and Federal Copyright Laws and Treaties. Any unauthorized reprint
or distribution of this book is prohibited. No part of this book may be reproduced
or transmitted in any form or by any means, electronic or mechanical, including
photocopying, recording, or by any information storage and retrieval system
without express written permission from the author / publisher.

F-Chart Software
Box 44042
Madison, WI 53744
http://fchartsoftware.com

(84) July 12, 2021

Starting with version 9.370, EES provides a Mastering EES menu item in the Help menu. If
the Mastering-EES.pdf file is placed in the same directory as the EES application, selecting
the Mastering EES menu item will start Adobe Reader, open the Mastering-EES.pdf file and
automatically enter the password.
TABLE OF CONTENTS

1 INTRODUCTION TO EES ..................................................................................................... 1


1.1 Acquiring and Installing EES .............................................................................................. 1
Acquiring EES......................................................................................................................... 1
Installing EES ......................................................................................................................... 2
Silent Installation .................................................................................................................... 3
Online Help............................................................................................................................. 3
1.2 Entering and Solving Equations .......................................................................................... 6
Entering Equations ................................................................................................................. 6
The Solution Window .............................................................................................................. 8
Decimal vs Comma Separator ................................................................................................ 8
The Variable Palette and Information dialog......................................................................... 9
Guess Values......................................................................................................................... 10
Limits..................................................................................................................................... 11
Display Format ..................................................................................................................... 11
Rules for Entering Equations................................................................................................ 13
Comments.............................................................................................................................. 13
Hyperlinks in the Equations Window.................................................................................... 14
Visible Hyperlinks ............................................................................................................ 14
Hidden Hyperlinks ............................................................................................................ 15
Built-In Math and String Functions...................................................................................... 16
External Functions and Procedures ..................................................................................... 16
String Variables .................................................................................................................... 17
The $TabStops Directive....................................................................................................... 18
Showing Values and Setting Variable Units in the Equations Window................................ 18
The Status Bar and Screen Background Color ..................................................................... 19
Equations and Display Preferences...................................................................................... 19
The Formatted Equations Window ....................................................................................... 23
The Splitter Bar..................................................................................................................... 25
Password Protection............................................................................................................. 25
Key Variables........................................................................................................................ 26
1.3 Parametric Tables.............................................................................................................. 28
Creating a Parametric Table ................................................................................................ 30
Alter Values........................................................................................................................... 31
Solving a Parametric Table .................................................................................................. 32
Formatting Columns ............................................................................................................. 35
The $If, $IfNot, $Else, and $EndIf Directives....................................................................... 35
Naming and Documenting Parametric Tables ..................................................................... 36
Saving and Loading Parametric Tables ............................................................................... 37
1.4 Basic Plotting..................................................................................................................... 39
Generating a Plot.................................................................................................................. 39
Modifying Axes...................................................................................................................... 41
Overlaying Plots ................................................................................................................... 43
Modifying Plots..................................................................................................................... 43
Automatic Update ................................................................................................................. 45
Error Bars............................................................................................................................. 45
The Plot Tool Bar.................................................................................................................. 46
The Cross-Hairs, Move, and Zoom Tools............................................................................. 49
1.5 Units................................................................................................................................... 51
Unit System ........................................................................................................................... 51
Entering Units....................................................................................................................... 51
Dual Units............................................................................................................................. 53
Units Recognized by EES...................................................................................................... 55
Checking Units...................................................................................................................... 55
Automatically Setting Units .................................................................................................. 57
The Convert Function ........................................................................................................... 58
The Units List........................................................................................................................ 59
Suggested Method for Working with Units ........................................................................... 61
The ConvertTemp Function .................................................................................................. 63
Adding Units ......................................................................................................................... 63
Using String Variables for Units .......................................................................................... 65
1.6 Printing .............................................................................................................................. 65
Printing a Hard Copy ........................................................................................................... 66
Copying Equations................................................................................................................ 66
LaTeX Report ........................................................................................................................ 68
1.7 Arrays................................................................................................................................. 70
Assigning Array Variables.................................................................................................... 70
Array Range Notation ........................................................................................................... 71
Two-Dimensional Arrays ...................................................................................................... 71
The Array Editor ................................................................................................................... 72
The Duplicate Statement ....................................................................................................... 73
Arrays in the Variable Information Dialog .......................................................................... 75
Using the Variable Information Dialog with Large Arrays.................................................. 76
Purge Unused Variables ....................................................................................................... 76
1.8 Lookup Tables and Lookup Files....................................................................................... 78
Creating a Lookup Table ...................................................................................................... 78
Entering Data........................................................................................................................ 78
Using Equations in a Lookup Table...................................................................................... 80
Saving and Loading Lookup Files ........................................................................................ 81
Deleting Lookup Tables from the Lookup Table Window .................................................... 82
Lookup Table/File Commands.............................................................................................. 82
Lookup File Formats............................................................................................................. 83
1.9 Other Features ................................................................................................................... 85
Built-In Constants ................................................................................................................. 85
Adding Constants .................................................................................................................. 86
The Calculator Window ........................................................................................................ 87
Preferences and Syntax Highlighting ................................................................................... 88
References ................................................................................................................................. 91
2 CURVE FITTING & INTERPOLATION ........................................................................... 92
2.1 Curve Fitting...................................................................................................................... 92
Curve Fitting Plotted Data ................................................................................................... 92
Curve Fitting Data in a Lookupt Table with the CurveFit1DT Procedure .......................... 97
Curve Fitting Array Data with the CurveFit1D Procedure.................................................. 98
2.2 Linear Regression ............................................................................................................ 101
2.2.1 The Linear Regression Menu command ................................................................... 101
2.2.2 The LinearRegression Procedure ............................................................................. 105
2.3 One Dimensional Interpolation ....................................................................................... 108
2.4 Two Dimensional Interpolation ....................................................................................... 110
The Interpolate2D Function ............................................................................................... 110
The Interpolate2DM Function ............................................................................................ 111
3 FUNCTIONS AND PROCEDURES................................................................................... 112
3.1 Equations and Assignment Statements............................................................................. 112
The Assignment Operator ................................................................................................... 113
3.2 Functions.......................................................................................................................... 113
Format of Functions ........................................................................................................... 113
First Example of a Function ............................................................................................... 114
Second Example of a Function ........................................................................................... 116
Setting and Checking Units for Function Variables ........................................................... 116
Variable Information Page for Function ............................................................................ 117
3.3 Procedures ....................................................................................................................... 118
Format of Procedures ......................................................................................................... 118
Example of a Procedure...................................................................................................... 119
3.4 Logic Statements .............................................................................................................. 121
If-Then-Else Statements ...................................................................................................... 121
Return Statements ............................................................................................................... 122
GoTo Statements and Statement Labels.............................................................................. 124
Repeat-Until Construct ....................................................................................................... 125
Case Statements .................................................................................................................. 125
3.5 Units in Functions and Procedures ................................................................................. 128
3.6 Arrays in Functions and Procedures ............................................................................... 130
Arrays as Arguments........................................................................................................... 131
Using the $Common Directive to Access Arrays................................................................ 132
Using the $Constant Directive to Set Array Limits ............................................................ 133
Arrays Table Window for Functions and Procedures ........................................................ 133
3.7 Using Lookup Tables and Files ....................................................................................... 137
3.8 The Beep and Print Commands ....................................................................................... 138
3.9 The Warning and Error Procedures ................................................................................ 139
The Warning Procedure...................................................................................................... 139
The Error Procedure........................................................................................................... 141
References ............................................................................................................................... 142
4 PROPERTY DATA .............................................................................................................. 143
4.1 Unit System ...................................................................................................................... 143
Unit System Dialog ............................................................................................................. 143
Specific Properties on a Molar vs Mass Basis.................................................................... 143
The $UnitSystem Directive ................................................................................................. 144
Unit Settings in the Status Bar ............................................................................................ 145
Importance of Unit Selection .............................................................................................. 145
4.2 Function Information ....................................................................................................... 145
4.3 Property Functions for Real Fluids and Mixtures........................................................... 146
Calling Protocol for Property Function ............................................................................. 146
List of Property Functions .................................................................................................. 147
The RealThermoProps Procedure ...................................................................................... 149
Built-in Real Fluids............................................................................................................. 151
Property Indicators............................................................................................................. 153
Fixing the State ................................................................................................................... 153
Two-Phase State.................................................................................................................. 154
The Example Box ................................................................................................................ 155
Vapor Compression Cycle Example ................................................................................... 157
Equations of State ............................................................................................................... 159
Properties of Water............................................................................................................. 160
The Reference State............................................................................................................. 161
The $Reference Directive.................................................................................................... 161
4.4 Property Functions for Ideal Gases................................................................................. 162
The Ideal Gas Model........................................................................................................... 162
List of Ideal Gas Fluids....................................................................................................... 163
Ideal Gas vs Real Gas Fluids.............................................................................................. 163
The IdealGasThermoProps Procedure ............................................................................... 164
The NASA Ideal Gas Database ........................................................................................... 167
The FluidType$ Function.................................................................................................... 168
The Ideal Gas Reference State & Chemical Reactions....................................................... 170
4.5 Psychrometric Properties ................................................................................................ 172
The Fluid AirH2O ............................................................................................................... 172
Properties Specific to Psychrometrics ................................................................................ 172
List of Psychrometric Properties ........................................................................................ 173
List of Indicators for Psychrometric Properties ................................................................. 173
Psychrometrics Example..................................................................................................... 174
The PsychProps Procedure................................................................................................. 175
4.6 Brine Properties................................................................................................................ 176
Brine Property Functions ................................................................................................... 176
Brine Fluid Mixtures........................................................................................................... 177
Using the Brine Property Functions ................................................................................... 178
The BrineProp2 External Procedure .................................................................................. 178
4.7 The Incompressible Substance and TPSX Libraries........................................................ 180
Incompressible Property and TPSX Property Library Functions ...................................... 181
Using the Incompressible and TPSX Library Property Functions ..................................... 183
Solid_Liquid_Props Library File (deprecated) .................................................................. 184
Incompressible and TPSX Property Tables ........................................................................ 184
Adding Incompressible Property Data ............................................................................... 187
4.8 Property Plots .................................................................................................................. 191
The Property Plot Dialog.................................................................................................... 191
Property Plots for Real Fluids............................................................................................ 192
Property Plots for Ideal Gases ........................................................................................... 197
Psychrometric Plots ............................................................................................................ 197
Property Plots for Brines .................................................................................................... 199
Property Plots for Substances in the Incompressible and TPSX Libraries ........................ 200
Overlaying States onto Property Plots ............................................................................... 201
4.9 NH3H2O (Ammonia-Water) ............................................................................................ 204
4.10 Property Data in External Procedures .......................................................................... 208
The IdealGasMixtureProps Library Procedure.................................................................. 208
The NASA Library............................................................................................................... 210
Ammonia-Water Properties ................................................................................................ 212
Sea Water Properties .......................................................................................................... 214
Lithium Bromide-Water and Lithium Chloride-Water Properties...................................... 214
The GENEOS Library ......................................................................................................... 216
The Peng-Robinson Library................................................................................................ 216
The EES_REFPROP Interface............................................................................................ 217
4.11 Adding Property Information......................................................................................... 223
Providing Data in Lookup Tables....................................................................................... 224
Providing Ideal Gas Property Data.................................................................................... 224
Providing Real Fluid Property Data represented by the Martin-Hou Equation of State... 227
Using REFPROP .fld Files ................................................................................................. 232
References ............................................................................................................................... 235
5 CONVERGENCE AND DEBUGGING ............................................................................. 236
5.1 Solution Methodology Used in EES................................................................................. 236
Numerical Solution of One Non-Linear Equation .............................................................. 236
Stopping Criteria ................................................................................................................ 239
Numerical Solution of Simultaneous Non-Linear Equations.............................................. 240
Blocking and Reordering Equation Sets ............................................................................. 245
5.2 The Residuals Window..................................................................................................... 247
Blocks.................................................................................................................................. 247
Residuals ............................................................................................................................. 248
Units.................................................................................................................................... 248
Calls and Time .................................................................................................................... 249
Procedures in the Residuals Window ................................................................................. 250
5.3 The Computational Flow Window .................................................................................... 251
5.4 Setting Guess Values and Limits....................................................................................... 258
The Variable Information dialog ........................................................................................ 258
Setting Guess Values and Limits using Variables............................................................... 259
Arrays in the Variable Information dialog ......................................................................... 260
Changing Variable Names.................................................................................................. 261
Variable Information Files ................................................................................................. 261
Using Arrays as Guess Values and Limits.......................................................................... 262
Default Variable Information ............................................................................................. 265
5.5 Using the Debug Window ................................................................................................ 266
Incorrect Degrees of Freedom............................................................................................ 266
Constrained Solution .......................................................................................................... 267
5.6 Debugging Techniques..................................................................................................... 268
Effective Use of EES ........................................................................................................... 268
The Update Guesses Command and Directive ................................................................... 269
The Residuals or Computational Flow Window as a Debugging Tool .............................. 272
Common Problems.............................................................................................................. 274
The $Trace Directive .......................................................................................................... 275
References ............................................................................................................................... 277
6 OPTIMIZATION.................................................................................................................. 278
6.1 One-Dimensional Optimization ....................................................................................... 278
Implementing an Optimization Problem............................................................................. 279
Objective Function.............................................................................................................. 281
Degrees of Freedom............................................................................................................ 281
The Min/Max Dialog........................................................................................................... 281
Stopping Criteria ................................................................................................................ 283
Guess Value and Bounds .................................................................................................... 283
The Golden Section Search................................................................................................. 283
The Quadratic Approximations Optimization Method ....................................................... 285
Min/Max Table.................................................................................................................... 288
6.2 Multi-Dimensional Optimization ..................................................................................... 290
The Conjugate Directions Method...................................................................................... 292
The Variable Metric Method............................................................................................... 294
The Nelder-Mead Simplex Method ..................................................................................... 294
The DIRECT Algorithm ...................................................................................................... 294
The Genetic Method............................................................................................................ 296
6.3 Constrained Optimization................................................................................................ 299
Implementing Constraints using Bounds ............................................................................ 299
Parameterizing Variables ................................................................................................... 301
Penalty Function................................................................................................................. 303
6.4 Other uses for Optimization.............................................................................................. 305
Solving Difficult Sets of Equations ..................................................................................... 305
Curve Fitting....................................................................................................................... 307
References ............................................................................................................................... 311
7 INTEGRATION.................................................................................................................... 312
7.1 Numerical Integration of Ordinary Differential Equation ............................................... 312
Example ODE ..................................................................................................................... 312
Analytical Solution.............................................................................................................. 313
Discretizing Time ................................................................................................................ 314
Euler’s Technique (First Order Explicit) ........................................................................... 314
Heun's Method (Second Order Explicit)............................................................................. 318
The Fully Implicit Method (First Order Implicit)............................................................... 321
The Crank-Nicolson Method (Second Order Implicit) ....................................................... 322
7.2 Equation-Based Integral Function .................................................................................. 323
Calling Protocol for the Integral Command....................................................................... 323
Entering the State Equations .............................................................................................. 323
Carrying out the Integration............................................................................................... 324
The Integral Table............................................................................................................... 325
Adaptive Step Size ............................................................................................................... 327
Integrating Simultaneous ODEs ......................................................................................... 329
The IntegralValue Command.............................................................................................. 332
Double Integration.............................................................................................................. 336
Multiple Integral Tables ..................................................................................................... 338
7.3 Table-Based Integral Function ........................................................................................ 339
7.4 Solving Partial Differential Equations ............................................................................ 340
8 UNCERTAINTY PROPAGATION.................................................................................... 346
8.1 Uncertainty Propagation using the RSS Method ............................................................. 346
The Root Sum Square Method............................................................................................. 346
Example of the RSS Method................................................................................................ 347
8.2 Uncertainty Propagation in EES ..................................................................................... 349
Assigning Uncertainties to Measured Variables ................................................................ 349
Determining the Uncertainties of Calculated Variables .................................................... 351
UncertaintyOf Function ...................................................................................................... 352
Uncer.Pardif and Uncert.Percent Functions...................................................................... 353
8.3 Uncertainty Propagation in Tables .................................................................................. 353
Uncertainty Propagation Table .......................................................................................... 353
Plotting Data with Uncertainties ........................................................................................ 354
Uncertainty Propagation with Lookup Tables.................................................................... 355
8.4 Uncertainty Propagation in Integrals............................................................................... 359
9 ADVANCED PLOTTING ................................................................................................... 363
9.1 Two-Dimensional Plots..................................................................................................... 363
Point Labels ........................................................................................................................ 363
Dual Axis Scales for Two-Dimensional Plots..................................................................... 365
The Cross-Hairs Tool ......................................................................................................... 369
Area Plots............................................................................................................................ 370
Bar Plots ............................................................................................................................. 373
Controlling the Appearance of Bar Plots ........................................................................ 375
Overlays on Bar Plots ..................................................................................................... 376
Bar Plots using String Values ......................................................................................... 378
Side-by-Side Bar Plots.................................................................................................... 379
Plotting Dates ..................................................................................................................... 382
Polar Plots .......................................................................................................................... 385
Using Variables as Axis Limits ........................................................................................... 387
Copying and Saving Plots................................................................................................... 389
Naming and Documenting Plots ......................................................................................... 391
Deleting Plot Windows ....................................................................................................... 391
Plot Templates .................................................................................................................... 392
9.2 Time Sequence Plots ........................................................................................................ 392
Creating the Initial Plot ...................................................................................................... 394
Activating the Time Sequence Display................................................................................ 395
Assigning Frame Numbers to Data Series.......................................................................... 396
Assigning Frame Numbers to Objects ................................................................................ 397
Making a Movie .................................................................................................................. 398
9.3 Three-Dimensional Plots .................................................................................................. 401
Three Column Data............................................................................................................. 403
Contour-Lines Contour Plot ............................................................................................... 403
Contour-Bands Plot ............................................................................................................ 405
Contour-Gradient Plot........................................................................................................ 406
3D Surface Plots ................................................................................................................. 407
3D Polygon/Points Plots..................................................................................................... 412
Symbol Color Plots ............................................................................................................. 416
9.4 Plot Thumbnails Window.................................................................................................. 417
References ............................................................................................................................... 418
10 SUBPROGRAMS and MODULES................................................................................... 419
10.1 Subprograms .................................................................................................................. 419
Format of a Subprogram .................................................................................................... 419
Solution and Residuals Windows ........................................................................................ 421
Guess Values and Limits of Inputs and Outputs ................................................................. 423
Subprograms with the Integral Command.......................................................................... 424
Subprograms to Determine the Limit of an Integral........................................................... 429
10.2 Modules.......................................................................................................................... 431
Module Execution ............................................................................................................... 431
The Solution Window .......................................................................................................... 432
The Residuals Window........................................................................................................ 433
Guess Values and Limits of Inputs and Outputs ................................................................. 434
10.3 Should you use Subprograms or Modules? ................................................................... 434
References ............................................................................................................................... 435
11 INTERNAL LIBRARY FILES ......................................................................................... 436
11.1 Writing and Saving Library (.lib) Files ......................................................................... 436
An Example Library File Function ..................................................................................... 437
Units in Library File Functions .......................................................................................... 437
Testing a Library File Function.......................................................................................... 440
Saving Functions as a Library File .................................................................................... 440
11.2 Loading and Using Library Files .................................................................................. 441
EES Library Routines in the Function Information Dialog................................................ 441
Libraries in the Userlib (Userlib64) Folder ....................................................................... 442
Manually Loading Library Files......................................................................................... 443
11.3 Help for Library Files..................................................................................................... 444
Using a Dedicated Help File .............................................................................................. 446
11.4 Application Library Files................................................................................................ 448
11.5 The Textbook Menu......................................................................................................... 449
11.6 The Library Manager...................................................................................................... 451
References ............................................................................................................................... 452
12 THE HEAT TRANSFER LIBRARY................................................................................ 453
12.1 Boiling and Condensation.............................................................................................. 453
12.2 Compact Heat Exchangers ............................................................................................. 457
Compact Heat Exchanger Data .......................................................................................... 457
Organization of the Compact Heat Exchanger Library ..................................................... 457
Non-Dimensional Functions ............................................................................................... 458
Geometry Functions............................................................................................................ 458
Coefficient of Heat Transfer Functions .............................................................................. 459
Pressure Drop Functions.................................................................................................... 460
12.3 Steady State Conduction Functions ................................................................................ 460
Conduction Shape Factors.................................................................................................. 460
Spreading Resistances ........................................................................................................ 462
12.4 Convection ...................................................................................................................... 463
Internal Forced Convection................................................................................................ 463
External Forced Convection ............................................................................................... 465
Free Convection.................................................................................................................. 467
Impinging Jets..................................................................................................................... 468
Regenerator Packings......................................................................................................... 469
12.5 Fin Efficiency .................................................................................................................. 470
12.6 Fouling Factors ............................................................................................................. 471
12.7 Heat Exchangers............................................................................................................ 471
Log Mean Temperature Difference Solutions..................................................................... 472
Effectiveness-NTU Solutions............................................................................................... 474
Axial Conduction and Regenerator Models........................................................................ 475
12.8 Radiation View Factors ................................................................................................. 475
12.9 Total Hemispherical Emissivity ..................................................................................... 477
12.10 Transient Conduction................................................................................................... 479
12.11 Pipe Dimensions .......................................................................................................... 480
12.12 Minor Losses and Flow Measurement......................................................................... 481
References ............................................................................................................................... 483
13 COMPLEX ALGEBRA ..................................................................................................... 484
13.1 Introduction to Complex Algebra in EES ...................................................................... 484
Assigning Complex Variables in Rectangular Form .......................................................... 485
Assigning Complex Variables in Polar Form..................................................................... 486
Units of Complex Variables ................................................................................................ 487
The Variable Information dialog ........................................................................................ 488
Complex Algebra ................................................................................................................ 488
Functions Specific to Complex Variables ........................................................................... 489
Built-In Functions and Complex Variables ........................................................................ 490
13.2 Complex Algebra Example ............................................................................................ 490
Parametric Table ................................................................................................................ 492
The $Real Directive ............................................................................................................ 494
Subprograms ....................................................................................................................... 495
14 DIRECTIVES...................................................................................................................... 496
14.1 Directives related to Display & Formatting Options .................................................... 496
$Allow ‘//’ ........................................................................................................................... 496
$Arrays................................................................................................................................ 496
$Bookmark .......................................................................................................................... 497
$DiagramUpdate On/Off .................................................................................................... 499
$Font ................................................................................................................................... 499
$HideWindow...................................................................................................................... 499
$Private............................................................................................................................... 499
$ShowWindow..................................................................................................................... 501
$SumRow............................................................................................................................. 502
$Syntax................................................................................................................................ 502
$TabStops............................................................................................................................ 503
$Warnings ........................................................................................................................... 503
14.2 Directives related to Units ............................................................................................. 503
$AutoSetArrayUnits ............................................................................................................ 503
$AutoSetUnits ..................................................................................................................... 504
$CheckUnits........................................................................................................................ 504
$ConvertEESREFPROPUnits On/Off /mass ..................................................................... 504
$UnitSystem ........................................................................................................................ 505
14.3 Directives for Code Segments........................................................................................ 506
$Common ............................................................................................................................ 506
$Constant ............................................................................................................................ 507
14.4 Directives related to Complex Algebra.......................................................................... 507
$Complex ............................................................................................................................ 507
$Real ................................................................................................................................... 508
14.5 Directives related to Saving & Copying Data ............................................................... 508
$CopyToLookup.................................................................................................................. 508
$Export................................................................................................................................ 509
$ExportPlot ......................................................................................................................... 511
$Import................................................................................................................................ 511
$OpenLookup...................................................................................................................... 514
$SaveLookup ....................................................................................................................... 515
$SaveTable.......................................................................................................................... 515
$SaveVarInfo /A ................................................................................................................. 516
14.6 Directives related to Program Execution & Debugging ............................................... 517
$ClearLookup 'LookupTableName' /C1..3 /R2..5.............................................................. 517
$ClearParametric 'ParametricTableName' /A /R220..500............................................... 517
$DefaultArraySize=100 ...................................................................................................... 517
$DoLast & $EndDoLast ..................................................................................................... 517
$If, $IfNot, $Else & $EndIf ................................................................................................. 518
$Include /R ......................................................................................................................... 523
$Input .................................................................................................................................. 524
$IntegralAutoStep ............................................................................................................... 525
$IntegralStop....................................................................................................................... 525
$IntegralTable..................................................................................................................... 526
$Load .................................................................................................................................. 526
$MaxCalls ........................................................................................................................... 526
$Reference { XE "reference state"} .................................................................................... 527
$RunMacroAfter ................................................................................................................. 527
$RunMacroBefore............................................................................................................... 528
StopCriteria......................................................................................................................... 528
$Trace ................................................................................................................................. 529
$UpdateGuesses.................................................................................................................. 530
$VarInfo .............................................................................................................................. 530
References ............................................................................................................................... 532
15 THE DIAGRAM WINDOW.............................................................................................. 533
15.1 Placing Graphic Objects in the Diagram Window ........................................................ 533
Development and Application Modes ................................................................................. 533
Graphical Objects from a Drawing Program..................................................................... 534
Graphical Objects Drawn in the Diagram Window ........................................................... 535
Drawing and Modifying Lines and Arrows ........................................................................ 536
Drawing and Modifying Rectangles ................................................................................... 538
Drawing and Modifying Ellipses or Circles ....................................................................... 540
Drawing and Modifying Polylines and Polygons ............................................................... 541
Accessing the Diagram Window Palette............................................................................. 543
15.2 Placing Text Items in the Diagram Window .................................................................. 546
Entering Plain Text ............................................................................................................. 546
Entering Formatted Text..................................................................................................... 548
15.3 Entering Input and Output Variables ............................................................................ 551
An Example of a Graphical User Interface ........................................................................ 551
Entering Input Numerical Variables from the Diagram Window....................................... 552
Displaying Output Variables on the Diagram Window...................................................... 553
Limits on Input Variables.................................................................................................... 555
Entering Input String Variables from the Diagram Window.............................................. 556
Mapping String Variables in a Drop-Down List to Equations ........................................... 558
The Find Command............................................................................................................. 560
15.4 Copying and Resizing the Diagram Window ................................................................. 561
The Copy Command in Application Mode.......................................................................... 561
The Copy Command in Development Mode ....................................................................... 562
Change Window Size Dialog .............................................................................................. 562
Clearing the Diagram Window........................................................................................... 563
15.5 Adding Calculate, Print, Plot Access, and Help buttons ............................................... 563
Adding a Calculate Button.................................................................................................. 563
Moving and Resizing the Calculate Button......................................................................... 564
Calculate Button Characteristics Dialog............................................................................ 564
Adding a Print Button ......................................................................................................... 566
Adding a Plot Access Button............................................................................................... 567
Showing a Plot on the Diagram Window............................................................................ 570
Adding a Help Button.......................................................................................................... 571
15.6 Child Diagram Windows................................................................................................ 571
Creating a Child Diagram Window.................................................................................... 572
How to Modify Child Diagram Property Information........................................................ 573
How to Access a Diagram Window from another Diagram Window................................. 575
15.7 Other Professional Version Enhancements___________ ............................................. 576
Group and Ungroup Selected Items Buttons ...................................................................... 576
Align Selected Items Button ................................................................................................ 577
Showing a Grid on the Diagram Window........................................................................... 577
Creating Links..................................................................................................................... 578
Adding an Audio-Visual Item.............................................................................................. 581
Saving and Loading User Inputs......................................................................................... 582
Add Check Box Item............................................................................................................ 583
Creating and Using Radio Button Groups.......................................................................... 586
Using Sliders for Inputting Values...................................................................................... 589
Allowing Equations in Diagram Input fields ...................................................................... 591
Entering a Filename into a String Variable ....................................................................... 596
Converting Units for Inputs and Outputs in the Diagram Window .................................... 596
16 DIAGRAM WINDOW ANIMATION.............................................................................. 603
16.1 Controlling the Attributes of Diagram Window Objects ............................................... 603
Attributes of Rectangle and Ellipse/Circle Objects ............................................................ 603
Attributes of Line Objects ................................................................................................... 606
Attributes of Polyline and Polygon Objects........................................................................ 607
Attributes of Text Objects.................................................................................................... 607
Attributes of Diagram Window Plot Objects ...................................................................... 610
Attributes of Button, Radio Group and Check box Objects ................................................ 612
Showing and Hiding Diagram Window Objects................................................................. 612
16.2 Setting Attributes within the Diagram Window ............................................................. 613
Setting Attributes with Text Drop Down Lists .................................................................... 613
Setting Attributes with a Check Box Object........................................................................ 618
Setting Attributes with a Radio Button Group .................................................................... 618
Controlling the Equations Window with Check Boxes and Radio Button Groups ............. 620
Improving the Response Time of Diagram Window Controls ............................................ 621
16.3 Exchanging Inputs and Outputs..................................................................................... 622
16.4 Using Parametric and Integral Tables for Animations ................................................. 628
Setting up an Animation Using the Parametric Table ........................................................ 629
Saving Animation Files for the Generation of a Movie ...................................................... 631
Setting up an Animation Using the Integral Table ............................................................. 631
17 DISTRIBUTABLE PROGRAMS ..................................................................................... 637
17.1 Distributable Program Setup and Startup Dialog ...................................................... 637
17.2 Setting Distributable File Information........................................................................... 642
17.3 Completing the Distributable File ................................................................................. 645
18 MACROS............................................................................................................................. 648
18.1 The EES Macro Window................................................................................................ 648
Creating a Macro in the Macro Window............................................................................ 649
Managing Macros in the Macro Window ........................................................................... 653
Saving Macro within the EES file ....................................................................................... 654
The EES Log File ................................................................................................................ 654
18.2 EES Macro Commands .................................................................................................. 656
18.3 Interacting with External Programs using Macros ....................................................... 694
Interacting with Microsoft Excel ........................................................................................ 694
Interacting with MATLAB................................................................................................... 697
18.4 Using a Macro for Serial Port Communications........................................................... 700
Basic Communication with the Arduino UNO.................................................................... 700
Logging Data to a Lookup Table and Plotting ................................................................... 702
18.5 Executing EES Macros from External Programs .......................................................... 709
Executing an EES Macro File from the Windows Run dialog............................................ 709
Executing an EES Macro File from MATLAB.................................................................... 710
Executing an EES Macro File from Excel .......................................................................... 712
Executing an EES Macro File from LabView..................................................................... 715
Executing an EES Macro File from DELPHI..................................................................... 718
18.6 Interacting with EES using Dynamic Data Exchange ................................................... 720
Dynamic Data Exchange with Excel................................................................................... 720
Dynamic Data Exchange with MATLAB ............................................................................ 722
Dynamic Data Exchange with DELPHI ............................................................................. 724
18.7 The CallMacro Statement .............................................................................................. 725
18.8 Useful Macro Examples................................................................................................. 728
19 EXTERNAL FUNCTIONS AND PROCEDURES ......................................................... 740
19.1 EES External Functions (.dlf files) ................................................................................ 740
External Functions written in C++ .................................................................................... 745
19.2 EES External Procedures - Type 1 (.dlp files)............................................................... 748
Type 1 External Procedures written in Pascal ................................................................... 749
Type 2 External Procedures written in C++ ...................................................................... 753
19.3 EES External Procedures - Type 2 (.fdl files)................................................................ 756
Type 2 (.fdl procedure) with the MinGW Open Source GCC Fortran Compiler ............... 760
19.4 Multiple Files in a Single Library File (.dll or .dll64).................................................... 764
19.5 Managing External Library Files .................................................................................. 767
Loading External Library Files .......................................................................................... 767
Providing Help for External Library Files ......................................................................... 767
19.6 External Python Procedures ......................................................................................... 768
20 THE COMPONENT LIBRARY ....................................................................................... 775
Example 20-1 Design and Analysis of a Heat Pump System .............................................. 778
Example 20-2 Analysis of a Pump and Piping System ...................................................... 787
20.1 Summary of the Component Library.............................................................................. 794
21 THE REPORT WINDOW................................................................................................. 797
21.1 Creating the Report......................................................................................................... 797
21.2 Inserting EES Variables.................................................................................................. 802
21.3 Inserting EES Plots ......................................................................................................... 803
Appendix A: Built-In Mathematical Functions .................................................................... 805
Appendix B: Built-In String Functions.................................................................................. 815
Appendix C: Directives ........................................................................................................... 818
Appendix D: Macro Commands............................................................................................. 821
Appendix E: Overriding Default Behavior ........................................................................... 833
Appendix F: EES File Types................................................................................................... 836
Appendix G: The 64-bit Professional version ....................................................................... 841
Appendix H: Startup Options................................................................................................. 843
1 INTRODUCTION TO EES
EES (pronounced 'ease') is an acronym for Engineering Equation Solver. The basic function
provided by EES is the numerical solution of linear and non-linear algebraic and differential
equations. It is important to recognize that EES is an equation-solver. EES utilizes equations
rather than the assignments that are used in a formal programming language. EES solves
systems of equations (i.e., relationships between variables) automatically, which frees the user
from having to develop their own iterative technique for solving a set of non-linear equations.
There are many additional features associated with EES; for example such as unit checking,
optimization, numerical integration, high quality property data, plotting and uncertainty analyses.
These features make EES a powerful tool for developing mathematical models of many types of
engineering systems. This chapter discusses the basic features of EES.

1.1 Acquiring and Installing EES


This section provides information about obtaining and installing the EES software. If EES is
already installed on your computer, you can skip this section.

Acquiring EES
EES is licensed and distributed solely by F-Chart Software LLC. A license for EES can be
purchased directly from the company website, http://fchartsoftware.com. Single and multi-user
licenses are available. In addition, the company offers academic licenses for educational
institutions involved in formal classroom instruction and academic research leading to a degree.
Details and costs for the different license options can be found at http://fchartsoftware.com/ees/.
If you do not have access to EES, you can download a demonstration copy of the program from
http://fchartsoftware.com/ees/demo.php. The demonstration copy will allow you to examine
most of the features and examples that are provided in this book.

Commercial and Professional versions are available. The Commercial version provides all of the
basic functionality of EES, includes the ability to solve 6000 simultaneous equations and allows
access high accuracy property information. It can be used to conduct parametric studies, do unit
conversion and check unit consistency, provide publication quality plots, perform uncertainty
analyses, and many other things.

The Professional version provides many additional features, as detailed at


http://fchartsoftware.com/ees/pro-comm-versions.php. The most important of these features are
the ability to solve up to 12000 simultaneous equations and the ability to create special purpose
executable EES programs that can be freely distributed to others. This book will provide
information for both the Commercial and Professional versions. Features that are only available
in the Professional version will be designated using the side bar adjacent to this paragraph.
2 Chapter 1: Introduction to EES

The current versions of EES are 32-bit Windows executable programs that are designed to run on
all modern 32 and 64-bit Windows operating systems such as Windows XP, Windows 7, 8 and
10. There is also a 64-bit Professional version of EES, as described in Appendix G.

Installing EES
Installing EES is relatively straightforward, but there are a few options that merit discussion. To
install the program, you will need both the Setup_EES.exe and EES.dft files. These files should
have been provided to you when you purchased the program or by a system administrator if you
obtained the program from your company or institution. There are a few institutions where the
EES.dft file has already been bundled with the setup file. Execute the Setup_EES.exe program
and click the Next button from the Welcome screen. Read the license agreement and, if you
agree, click the I Agree button and then click the Next button. Continue to click the Next button
until you see the Select Destination Directory dialog, shown in Figure 1-1.

Figure 1-1: Select Destination Directory dialog.

The default directory that EES will be installed into is named EES32. EES is a 32-bit program,
but it will operate on all modern 32-bit and 64-bit Windows operating systems. (See Appendix
G for information on the 64-bit Professional version.) You can change the directory name, if you
wish, by clicking the Browse button. Depending on the particular installation program, you will
need to copy the EES.dft file to the directory that you choose to install EES. Click the Next
button after you have selected the directory.

The next window, shown in Figure 1-2, provides several installation options. If selected, the
Install Heat Transfer Library option will install an extensive set of library functions that facilitate
heat transfer calculations. These functions have been developed to accompany the text book
Heat Transfer, by G. F. Nellis and S.A. Klein (2009). Selection of this option is recommended
unless you are sure that you will never be doing any heat transfer calculations. A discussion of
these library functions is provided in Chapter 12.
Chapter 1: Introduction to EES 3

Figure 1-2: Select Components dialog.

EES allows you to save custom Units and Constants files as discussed in Sections 1.5 and 1.9. If
you have done this, unselect the Overwrite Units files and Overwrite Constants.txt file in Figure
1-2. Otherwise these files will be replaced by the files in the installation program.

Clicking the Next button will install the program. If EES fails to start, the most likely problem is
that the EES.dft file is not contained in the directory that the program was installed into. In this
case, copy the EES.dft into the install directory and then restart EES by double-clicking on the
EES.exe icon or by entering C:\EES32\EES.exe in the Windows run dialog.

Silent Installation
It is possible to install EES silently, so that it installs the program with the default options and
without displaying any confirmation windows. To do a silent install, enter:

C:\myDir\Setup_EES.exe /s

into the Windows Run dialog after replacing myDir with the directory name where the
Setup_EES.exe program is located. By default, EES will place the program in the C:\EES32
directory (for the 32-bit version) or in the C:\EES64 dir (for the 64-bit version).

Online Help
Extensive online help is provided with the EES program installation. The index page for this
help file is shown in Figure 1-3. The online help can be made visible by selecting Help Index
from the Help menu or by pressing the F1 key. The help file is heavily hyperlinked. Clicking on
a word shown in blue font will move the display focus to that subject. There is also a Contents
box and an Index in the left pane of the Help window, as seen in Figure 1-3. Clicking on any
item in the Contents box will link directly to page for that item. The Index page allows you to
search for a specified keyword.
4 Chapter 1: Introduction to EES

Online help information for built-in and library functions can accessed by selecting the function
name in the Equations window (e.g., by double-clicking) followed by a right-click to bring up a
popup menu. Help for the selected function will be one of the options.

The EES help is in file EES.chm. The .chm extension stands for compiled HTML file and it is
the preferred method for distributing online help for Windows programs. However, some
networks do not allow .chm files to be transferred from a server to a client computer due to
possible security concerns. If you find that the online help is not working, we recommend that
you contact your Information Technology person, as this problem can be resolved. (See
http://www.helpscribble.com/chmnetwork.html or http://support.microsoft.com/kb/896358).
However, the EES help files are also located on the F-Chart Website on page
http://fchartsoftware.com/ees/eeshelp/ees_help_index.htm, which provides an alternative if the
EES.chm file is not made available. Note that the online help file has a Search tab that can be
used to search for keywords.

Several other methods of providing help are available within EES. They can all be accessed
from the Help menu. The EES manual is a .pdf file that is provided with EES and also available
on the F-Chart web site on page http://fchartsoftware.com/assets/downloads/ees_manual.pdf.
The manual can be accessed with the EES manual command if the manual is placed in the same
folder as the EES application.

The Mastering EES eBook that you are currently reading can also be accessed from the Help
menu by selecting the Mastering EES menu command. Accessing Mastering EES in this manner
requires that the Mastering-EES.pdf file be placed in the same folder as the EES application.
EES will attempt to automatically enter the password when this menu command is selected.
Note that there is a Check for New Mastering EES command in the Help menu. Selecting this
command will check to see if a newer version of the Mastering EES ebook is available and if so,
provide the option to download it from the website.

A number of short YouTube tutorials have been prepared directed to particular skills in EES,
such as plotting, using Parametric tables, and checking units. These tutorials can be accessed
from the YouTube Tutorials command in the Help menu.
Chapter 1: Introduction to EES 5

Figure 1-3: Online help provided by pressing F1


6 Chapter 1: Introduction to EES

1.2 Entering and Solving Equations


A mathematical model of an engineering system is based on a system of equations that result
from the application of appropriate theory and simplifications. These equations describe mass,
energy, and entropy balances, rate relations, properties, etc. Modern computer tools, such as
EES, facilitate the solution of the large set of coupled equations that result from the analysis of a
typical engineering system. When you open EES for the first time you will encounter the
Equations Window where the equations that are to be solved are entered. EES allows the user to
enter equations rather than assignments, as are required by most formal programming languages.
This is an important distinction. In an assignment statement, the value of each variable on the
right side of an expression must have been previously determined. An equation is simply a
relationship between variables. Assignments are explicit and can be solved sequentially. A set
of equations may be implicit and nonlinear and must be solved simultaneously and iteratively.

Entering Equations
Consider the following set of equations:

x y 3 (1-1)

y  z4 (1-2)

z  x2  3 (1-3)

Equations (1-1) through (1-3) are three non-linear equations in the three unknowns x, y, and z.
However, they are not directly solvable using most formal programming languages (e.g.,
MATLAB or Fortran) because they are equations rather than assignments. In order to solve this
system of equations using a formal programming language, it would be necessary to either
employ an iterative solution technique (e.g., successive substitution) or carry out sufficient
algebra to convert the equations into assignments. Let's take the latter approach here.
Substituting Eq. (1-3) into Eq. (1-2) provides:

y  x2  3  4 (1-4)

Substituting Eq. (1-4) into Eq. (1-1) provides:

x  x2  7  3 (1-5)

which can be rearranged:

x 2  x  10  0 (1-6)

Equation (1-6) is a quadratic equation that can be solved using the quadratic formula:
1  12  4  10 
x (1-7)
2
Chapter 1: Introduction to EES 7

Equation (1-7) has two solutions:


1 41
x   2.702 (1-8)
2 2
and
1 41
x   3.702 (1-9)
2 2
Substituting Eqs. (1-8) and (1-9) into Eqs. (1-3) and (1-4) provides the two solutions to the
original set of equations: x = 2.702 or -3.702, y = 0.2984 or 6.702, and z = 4.298 or 10.70.

At its most fundamental level, EES is an equation solver that solves sets of nonlinear equations
directly. For example, the three equations (1-1) through (1-3) can be entered directly into the
Equations Window, as shown in Figure 1-4.

Figure 1-4: Equations Window with Eqs. (1-1) through (1-3) entered.

In this book, text that is entered in the Equations Window will be shaded, as shown below.

x+y=3
y=z-4
z=x^2-3

The Variable Information palette appears to the right of the Equations window. It shows the
variables that have been defined and their units. Click the Update button to update the palette to
the current contents of the Equations window. Slide the bar that separates the Equations window
and the palette left or right to adjust the size of the palette. Variable information for the Main
Program is shown by default. Click the Menu button to show variable information for
Procedures, Functions, Subprograms and Modules that are defined in the Equations window.

Figure 1-5: Equations Window after clicking the Update button in the Variable Information palette
8 Chapter 1: Introduction to EES

The Solution Window


Select Solve from the Calculate menu (or use the shortcut F2) in order to initiate the iterative
process that EES uses internally to solve the system of equations. EES will re-order and block
the equations in a logical manner (see Chapter 5) and then, starting from a guessed solution, it
will iteratively search for an actual solution to the equations. The result should be the dialog
shown in Figure 1-6, which shows that the calculations were successfully completed and
provides some of the details of the process (which will be discussed more completely in Chapter
5).

Figure 1-6: Dialog indicating that the calculations are complete.

Select Continue to proceed to the Solution Window, shown in Figure 1-7.

Figure 1-7: Solution Window.

EES has identified one of the two solutions to the equation set. The other solution can be found
by changing guess values, as explained below. The process of solving the equations was done
internally; the user is not required to carry out any algebra or iteration.

Decimal vs Comma Separator


The solution is shown in Figure 1-7 using the decimal point as the decimal separator. However,
EES operates just as well using a European numerical formatting style. Close EES and open the
Regional and Language Options dialog in the Windows Control Panel. Under the Regional
Options tab, select a European language (e.g., French). Alternatively, enter $Keyboard EU into
the Equations window. Open EES and solve the problem again to obtain the Solutions Window
shown in Figure 1-8; note that the decimal separator is now a comma rather than a decimal point.
Chapter 1: Introduction to EES 9

Figure 1-8: Solutions Window using a European format.

The Variable Palette and Information dialog


The equations shown in Figure 1-4 are non-linear and thus they have more then one solution.
Why did EES identify one of the solutions (x = 2.702, y = 0.2984, and z = 4.298) as opposed to
the other one (x = -3.702, y = 6.702, and z = 10.70)? The answer is that the result depends on the
guess values and limits that have been set for each variable. EES uses a variation of Newton's
method to solve systems of equations, as will be discussed in Chapter 5. This technique begins
with an assumed or guessed value of each variable and then iteratively adjusts these values until
the equations are satisfied. In situations where multiple solutions exist, EES will likely converge
to the solution that is closest to the guessed solution that is used to start the process.

There are several ways to view or change variable information. The simplest is to simply click
the mouse button on the variable name in the Variable Information palette. This action will
bring up the information for this one variable, as shown in Figure 1-9. The guess value, limits
units, alternate units and other information can be viewed or changed for the selected variable in
this dialog.

Figure 1-9: Dialog that appears after clicking on a variable in the Variable Information palette

Selecting the Hilite vars used once control in the Varialble Palette will highlite variable in the
selected program unit with a buff yellow background. For example, add the equation, xy=x+y to
the equations shown in Figure 1-5. Click the Hilite var used once button and the display will
appear as seen in Figure 1-10. Variables that are used only once are sometimes the result of a
typing error and highlighting them may help identify such problems.
10 Chapter 1: Introduction to EES

Figure 1-10: Variable Palette showing a variable used only once.

Note that the Variable Information dialog can be used as a smart Find command. Right-clicking
on a variable in the palette will locate it in the Equations window. Right-clicking on the variable
a second time will find the next occurrence of the variables.

In some cases, it is more convenient to display the variable information for all variables in the
program unit. This can be accomplished by selecting Variable Info from the Options menu (or
by pressing F9 or by right-clicking the Update button in the Variable Information palette.) The
full Variable Information dialog will appear, as shown in Figure 1-11. Use the mouse wheel to
scroll through long lists of variables.

Figure 1-11: Variable Information Window.

Guess Values
There is a row corresponding to each of the three variables that make up the problem. Columns
allow the user to change various characteristics of these variables. The first column corresponds
to the guess values for each variable; these are the values used to start the iterative solution
process. By default, the guess value for each variable is 1. Note that x = 1, y = 1, and z = 1 is not
the correct solution, but it is closer to the solution x = 2.702, y = 0.2984, and z = 4.298 than it is
to the alternative solution x = -3.702, y = 6.702, and z = 10.7. In order to converge to the other
solution, it is necessary to change the guess values. For example, change the guess value of x to
something closer to x = -3.702 (e.g., -5), select OK and press F2 (the shortcut for the Solve
command). The solution identified by EES is shown in Figure 1-12. Guess values can also be
provided using other EES variables or equations, as described in Section 5.3.
Chapter 1: Introduction to EES 11

Figure 1-12: Solution Window with modified guess value.

Limits
Lower and upper limits for each variable can also be set in the Variable Information Window.
For example, in order to identify only a solution for which the value of x is negative, the Variable
Information Window could have been set up as shown in Figure 1-13.

Figure 1-13: Variable Information Window with limits set for the variable x.

Display Format
All EES numerical values use double precision that internally provides 20 (32-bit version) or 16
(64-bit version) significant figures of precision. Tthe display format can be separately specified
for each variable. The available display formats are shown in Table 1-1.

Table 1-1: Display Formats for EES Variables


A Auto EES will internally choose a display format and number of significant figures
F Fixed Decimal Specified number of digits to the right of the decimal separator
E Exponential One signficant figure is shown to the left of the decimal separator and an
exponent following letter 'E' at the end of the display to indicate the powers of
10 that the value should be multiplied by.
G Engineering Similar to Exponental format, but the exponent is always an factor of 3.
N Significant Figs. Display numerical values with a specified number of significant figures
S String String format is used for string variables or for text in a Lookup table
T Time Time format allows time to be displayed in various ways
D Date Date format is appropriate for values that are to be interpreted as dates

In the Variable Information dialog, the display format is controlled by three columns under the
word Display. The first column indicates the format using the letter in the first column of Table
1-1. The number of significant figures or decimal digits is controlled with the entry in the second
12 Chapter 1: Introduction to EES

column. This can be an integer between 0 and 9 or the letter ‘M’, which indicates the maximum
number of significant figures. The third column provides additional formatting options such as
underline, box, italic, etc.

For example, the A in the first of the three columns under the word Display in Figure 1-13
indicates Auto format. This is the default format. In this case, EES selects the number of
significant figures and the value in the second column cannot be changed. Click on the A in the
second row of the able and select F. Select 9 from the second column and Boxed from the third
column so that the dialog appears as in Figure 1-14.

Figure 1-14: Variable Information dialog with format specified for variable y.

Click OK and then solve the equations, The Solutions window will appear as in Figure 1-15.

Figure 1-15: Solutions Window with an altered format for the variable y.

The display format can also be set directly in the Solution Window by right-clicking on a
variable. This will will bring up the Specify Format and Units dialog where the format for the
selected variable(s) can be directly entered.

The units column shows the units that have been entered for the variables. Units can be entered
directly into the column. Note that Units header is a drop down list. Clicking the arrow to the
right of Units allows for a selection of displaying/entering the base or alternative units.
Chapter 1: Introduction to EES 13

Rules for Entering Equations


Let's return to the Equations Window. Notice that the equations can be entered in any order and
rearranged algebraically in any way. For example, we can switch the order of the first two
equations and switch the right and left sides of the third equation and EES will identify the same
solution.

y=z-4
x+y=3
x^2-3=z

The Equations Window functions a lot like a word processor. You can use the cut (Ctrl+X),
copy (Ctrl+C), paste (Ctrl+V), Find, Replace, and undo (Ctrl-Z) commands just as you would in
Microsoft Word® or other programs that manipulate text. Multiple undo/redo capability is
provided for up to 32 changes. Equations are typically entered one per line; however, multiple
equations can be entered on the same line provided that they are separated by a semicolon (or a
colon if you are using European format):

y=z-4; x+y=3; x^2-3=z

The mathematical operators and order of operation used in the equations are consistent with
those used by most any programming language. For example, the equation:

a=2^3+3*4+2

will result in a = 22. Variable names in EES must start with a letter but they can include any
U.S. keyboard character except ( ) * / + - { } or ;. EES is case-insensitive; that is, the symbols x
and X are interpreted to be the same variable in the Equations Window. Very long equations can
be broken into two lines for ease of reading or improved printing by using the ampersand (&).
Our example doesn't include any long equations, but we could still break the first equation into
two lines according to:

x+y&
=3
y=z-4
z=x^2-3

Comments
It is good practice to annotate your EES code in order to clarify the meaning behind the equation
set. Typically each equation is followed by a comment that is ignored by the equation solver
itself but is visible to the user. Comments in the Equations Window should be enclosed either in
curly braces or quotes. Any line that begins with two forward slashes is also considered a
comment. The comments are displayed in blue (by default) in the Equations Window to indicate
that they are not part of the equation set that will be solved. Comments that begin with the !
character (referred to as comment type 2) are displayed in red by default. The default colors for
comments can be changed in the Equations tab of the Preferences dialog (Options menu).

//this is a set of equations


14 Chapter 1: Introduction to EES

x+y=3 {comment for line 1}


y=z-4 "comment for line 2"
z=x^2-3 "! this is a type 2 comment"
//this is a comment

Occasionally it will be useful to temporarily remove an equation or a group of equations from the
Equations Window. Of course, you could just delete the equation(s) and then type them back in
if and when they are needed again. However, a better solution is to "comment them out".
Highlight the equation(s) to be removed and then right-click to bring up a pop-up menu, as
shown in Figure 1-16. Select Comment {} in order to place curly brackets around the entire
section of highlighted code, temporarily removing it from the equation set. To restore the
equation(s), highlight the commented code, right-click and select Undo Comment {}.

Figure 1-16: Commenting out the last two equations.

Hyperlinks in the Equations Window


Two types of hyperlinks (visible and hidden) can be entered within the comments in the
Equations Window. Visible hyperlinks can be entered in both the Commercial and Professional
versions. Hidden hyperlinks can only be entered in the Professional version.

Visible Hyperlinks
EES will automatically recognize hyperlinks that begin with http:\\, https:\\, or file: For example,
enter:

"http:\\fchartsoftware.com"

and notice that it becomes a link to that web page. A summary of the recognized visible hyper
link keywords is provided in Table 1-2.
Chapter 1: Introduction to EES 15

Table 1-2: Summary of recognized hyperinks.


Hyperlink Description
http:\\fchartsoftware.com Open the default browser and point it at the web page that follows http:
https:\\fchartsoftware.com Open the default browser and point it at the web page that follows https:
file:c:\ees32\ees_manual.pdf Open the file that follows file: and start the appropriate application.
\\EES_Solution Open the Solution Window and bring it to the front.
\\EES_Format Open the Formatted Equations Window and bring it to the front.
\\EES_Plot Open the Plot Window and bring it to the front.
\\EES_PlotN Open Plot Window N where N is an integer and bring it to the front.
\\EES_Parametric Open the Parametric Table and bring it to the front
\\EES_Lookup Open the Lookup Table and bring it to the front.
\\EES_Array Open the Array Table and bring it to the front.
\\EES_Integral Open the Integral Table and bring it to the front.
\\EES_Report Open the Report Window and bring it to the front.
\\EES_Diagram Open the Diagram Window and bring it to the front.
\\EES_Residual Open the Residuals Window and bring it to the front.
\\EES_Calculator Open the Calculator Window and bring it to the front.
\\EES_Solve Solve the current set of equations.
\\EES_SolveTable Apply the Solve Table command from the Calculate menu.
\\EES_MinMax Apply the Min/Max command from the Calculate menu.
\\EES_MinMaxTable Apply the Min/Max Table command from the Calculate menu.

Hidden Hyperlinks
Hidden hyperlinks do not display the link itself. Instead, the selected text that, when clicked,
will execute the link is displayed with an underline font. Hidden hyperlinks can only be added
with the Professional version, but once added, they can be used in both the Commercial and
Professional versions. To enter a hidden hyperlink, select the text that is to be associated with
the link. Then click the right mouse button and select the Insert Link command from the popup
menu (Figure 1-17). This will bring up a dialog in which you enter the hyperlink.

Figure 1-17: Inserting a hyperlink into the Equations Window (Professional version)

Clicking on this text in the Equations window will launch the link. The link will also be
available in the Formatted Equations window. Syntax highlighting must be on in order for the
links to be active. Syntax highlighting can be toggled on/off by clicking on the control at the
bottom right of the Equations window. Note. You can edit the text without launching the link
by holding the Ctrl key down when selecting the text. A hidden hyperlink can be removed by
selecting the link and then clicking the Link button or by right-clicking the link and selecting
16 Chapter 1: Introduction to EES

Remove Link from the popup menu. The link can also be removed by deleting the text
associated with the link, including the spaces before and after the text.

Built-In Math and String Functions


EES provides many built-in functions. The built-in math functions provide basic mathematical,
trigonometric, statistical capability as well as commands to operate on data files and tables. A
complete list and description of all built-in math functions is provided in Appendix A. A list and
description of built-in string functions is provided in Appendix B.

The built-in math functions can be conveniently accessed by selecting Function Information
from the Options menu, which displays the Function Information dialog appearing in Figure 1-
18. By default, all the built-in math and string functions are initially shown in the list on the left
side of the dialog. The list of functions can be reduced by selecting a function classification
from the list on the right side. An example of the proper use of the selected function is shown in
the Ex: edit control at the bottom of the dialog. The text in the Ex: edit control can be edited in
the conventional manner. Clicking the Paste button will paste the contents of this control into
the Equations Window at the current cursor position.

External Functions and Procedures


A function is a code segment that accepts one or more inputs and returns a single result
associated with the function name. A procedure is similar to a function, but it can return one or
more results and it is accessed by a Call statement. Functions and procedures that are entered
directly in the Equations Window, as described in Chapter 3, are referred to as internal functions
and procedures. Although they are originally entered in the Equations Window, they can
subsequently be saved as library files having a .lib/.lib64 file (or .lib64 for the 64-bit version) file
name extension, as described in Chapter 11. A very powerful feature of EES is that functions
and procedures can be written in any compiled language, such as Pascal, C, C++ or Fortran.
These code segments, referred to as external functions and procedures, are used in exactly the
same manner as internal EES functions and procedures that have been saved in library
(.lib/.lib64) files, as described in Chapter 11. They can even be coded so that the units of the
input and output variables will be checked by EES, in the same manner as for internal functions
and procedures. Warning and error messages can be returned from the external routines and
displayed by EES. External functions and procedures will be automatically loaded when EES
starts if they are placed in the Userlib directory. Alternatively, they can be manually loaded
using the Load Library command from File menu or the $INCLUDE directive. Help files can be
provided for documenting external functions and procedures in the same manner as described in
Chapter 11 for library files. External functions and procedures offer some significant
advantages. Because they are written in a compiled language they will execute much faster
(10x) than their internal counterparts. Also, the equations that are employed in external
functions or procedures are not visible to the user. External functions and procedures are written
as dynamic link library routines in the Windows operating system, as explained in this chapter.
Chapter 1: Introduction to EES 17

Figure 1-18: Function Information dialog showing math and string functions.

String Variables
EES provides both numerical and string variables. A string variable is identified with a variable
name that ends with the $ character. The variable name must begin with a letter and consist of
30 or fewer characters, including the $ character. String variables can be set to string constants,
which are strings that enclosed with single quote marks.

A$ = 'carbon dioxide'

String variables can be used in EES equations anywhere in which character information is
provided. For example the name of a fluid provided to a thermophysical property function may
be a string variable, as shown in Section 4.3. A string variable may be used to supply the units
of other variables, as shown in Section 1.5. String variables may be passed as arguments to
internal functions, procedures, modules, and subprograms or to external functions and
procedures as described in Chapters 3 and 10. String variables are very useful in the Diagram
window, as shown in Chapter 15. String functions are provided to manipulate string variables
and to convert them to or from numerical values. A complete list of string functions is provided
in Appendix B. String functions can be accessed from the Function Information dialog, as
shown in Figure 1-18.
18 Chapter 1: Introduction to EES

The $TabStops Directive


Directives are instructions to EES that are usually executed before the equations are compiled
and solved. Directive instructions are preceded by the dollar sign ($) and provide a powerful
method for controlling an EES solution. Chapter 14 discusses the use of directives in detail and
a complete list of directives is provided in Appendix C. However, we will make use of various
directives throughout the text. The $TabStops directive provides a mechanism for controlling the
location of the tab stops used in the Equations Window. The protocol for using the $TabStops
directive is shown below:

$TabStops TabStop1 TabStop 2 ... TabStop5 Units

where TabStop1, TabStop2, etc. are numerical values corresponding to the desired positions of the
tabs and Units indicates the units used for the tabs. The value of Units must either be in (for inch)
or cm (for centimeter). The code below sets two tab stops at 1 inch and 2 inch; notice that the
locations of the comments have shifted to 1 inch, which is consistent with the first tab stop set in
the $TabStops directive.

$TabStops 1 2 in

//this is a set of equations

x+y=3 {comment for line 1}


y=z-4 "comment for line 2"
z=x^2-3 "! this is a type 2 comment"

Showing Values and Setting Variable Units in the Equations Window


Selecting a variable in the Equations Window will cause a small hint window to appear just
below the variable. The hint window will show the value of the variable, if calculations have
been completed, and variable units. The variable can be easily selected by double-clicking the
left mouse button when the cursor is positioned over the variable. This capability makes it
unnecessary to refer to the Solutions window to determine values of EES variables. After a
variable has been selected, right-clicking will bring up a pop-up menu that has Variable Info as
one of the menu items. Selecting Variable Info will provide a small dialog window in which the
format and units of the variable can be entered. This is perhaps the easiest way to enter the units
of a variable. However units can also be entered in the Solution Window and in the Variable
Information dialog.
Chapter 1: Introduction to EES 19

The Status Bar and Screen Background Color


The status bar is located at the bottom of the Equations Window, as shown in Figure 1-19.

Figure 1-19: Equations window and Status bar.

Clicking the mouse button in the first panel (B|W) toggles the screen between a white and black
background for the Equations, Formatted Equations, Solutions, and Residuals windows. The
default text colors are adjusted to ensure readability (Figure 1-20) and they can be further
adjusted in the Display tab of the Preferences dialog (Figure 1-21).

Figure 1-20: Equations window with black background.

The second panel will display either US or EU. If US is displayed, the decimal separator is the
decimal point; otherwise it is a comma. The next panel displays the line and character on that
line at which the cursor is positioned. The various values of the current settings are displayed in
subsequent panels on the status bar, including the word wrap, overwrite, and caps lock settings.
Clicking the mouse button with the cursor positioned in any of these panels allows the settings to
be changed. The current unit system (discussed in Section 1.5) is displayed. The Warning panel
controls whether or not a window showing any warnings messages will be automatically
displayed after calculations are completed. These warnings can be manually displayed by
selecting Warnings from the Windows menu. The next two panels indicate whether unit
checking, and complex algebra are currently activated. The last panel toggles the syntax
highlighting setting. See section 1.9 for information relating to syntax highlighting.

Equations and Display Preferences


Many of the characteristics of the Equations Window can be altered using the Preferences dialog
accessed by selecting Preferences from the Options menu. Select the Syntax tab to bring up the
dialog shown in Figure 1-21, which allows the format used to display function name, EES
keywords, and EES constants in the Equations window to be specified. Long lines in the
20 Chapter 1: Introduction to EES

Equations window are normally wrapped. This option is controlled by the Wrap setting in the
Equations window status bar at the bottom of the Equations window. If the Display line-break
indicator control is checked, a red hyphen will appear in the left margin to indicate that this line
continues from the one above. The Display uniform case for variable names will set the upper-
lower case of the a variable name to the way it is first entered. Up to five tab stops can be set in
this dialog in either centimeters or inches. (Click cm or in to toggle the unit setting.) If the
Preferences are stored, using the Store button, these settings will be the defaults. Up to 25 tab
stops can also be set with the $TabStops directive. See section 1.9 for more detail on syntax
settings.

Figure 1-21: Syntax setting page of the Preferences dialog.

Additional display setting are provided on the Display page shown in Figure 1-22. The font type
and size affects the font in all of the windows - not just the Equations window. There are two
types of comments. Comments that begin with an explanation character (!) can have a different
color then normal comments. For late-night coders, the background color for the Equations,
Solutions, Formatted Equations and Residuals windows can be set to black using the toggle
control at the bottom of the dialog. The background can also be set by clicking in the first pane
of the the status bar at the bottom of the Equations window.
Chapter 1: Introduction to EES 21

Figure 1-22: Display settings page in the Preferences dialog.

The settings on the Options page are shown with their default settings in Figure 1-23. An
explanation of each option follows:

Figure 1-23: Options page in the Preference dialog.

Autosave every XXX minutes instructs EES to save the .EES. The information is saved to a
temporary .EES file that has the same name as the open EES file, but with a tilde (~) preceding
the filename. The autosave file is deleted when a new file is created or opened or when EES is
closed at the end of the work session, so do not depend upon it for permanent storage. You
should always save any file that you intend to use at a later time using the Save or Save As
commands. However, if EES quits unexpectedly, the last saved copy of the backup file should
still be available in your directory.
22 Chapter 1: Introduction to EES

Allow = in functions/procedure equations allows either an = or := to be used in the assignment


statements in Functions and Procedures. The equations used in Functions/Procedures are similar
to those used in FORTRAN, C, or Pascal. In assignment statements, the variable on the left of
the equation is set to the value on the right of the equation. The equation X:=X+1 is permitted in
a Function or Procedure, but not in a module or in the main body of EES. To accentuate this
difference, Functions and Procedures normally use the := sign (as in Pascal) rather than an = sign
in the equations.

Hide Solution window after change will cause the Solution, Arrays and Residuals windows to be
hidden if a change is made to the Equations window after a calculation is completed.

Include a Sum row in the Parametric Table will display the sum of the values in each column of
the Parametric Table in the bottom row of the table. The values in the Sum row are updated after
the calculations are completed. The option can also be turned on or off with the $SUMROW
directive.

Put Main array variables in the Arrays Table allows array variables (variables that include
brackets surrounding a subscript number) to be displayed in the Arrays table window, rather than
in the Solutions window. The Arrays table window will be automatically created after
calculations are completed showing all array values used in the Main program with the array
index value in the first column. This option can also be turned on or off with the $ARRAYS
directive. Note that the array variables in Functions, Procedures, Subprograms, and Modules can
also be displayed in separate tabbed windows of the Arrays table window by using the
$ARRAYS directive.

Display warning messages controls the default behavior of whether or not warning messages will
be displayed after calculations are completed. Warning messages may be generated internally if,
for example, thermodynamic property correlations are being applied beyond their range of
applicability, or by the user with the WARNING procedure. This option can also be turned on or
off with the $WARNINGS directive or with the control in the status bar of the Equations
window.

Maintain a list of most recent files in File menu will, if selected, provide menu items for up to
eight recently opened files. Selecting any of these menu items will open the corresponding file,
just as if the Open command were selected.

Display menu speedbar will present a series of buttons on a palette directly below the main
menu. These buttons provide quick access to the most frequently applied EES menu commands.

will check the unit consistency of each equation after calculations are
Check units automatically
completed. This option can also be invoked from the Equations window with the
$CHECKUNITS directive or by clicking the Unit Chk control in the status bar at the bottom of
the Equations window.

Auto set array units will set the units (and alternate units) of every variable in an array to the
units of the first array variable. This action occurs when the Arrays table is displayed and when
Chapter 1: Introduction to EES 23

exiting the Variable Information dialog after clicking the OK button. This setting can also be
made using the $AutoSetArrayUnits directive.

Set units automatically when possible will, if enabled, cause EES to enter the units of variables
for which the units have not been previously specified. Units will be set only when a variable is
by itself on the left hand side of an equal sign and a unit warning would otherwise occur. Note
that the same effect can be accomplished using the $AutoSetUnits directive.

Use enhanced convergence techniques will algebraically rearrange equations into equivalent
forms that converge more readily, reducing the need to provide guess values.

The Formatted Equations Window


The equations can also be viewed in an easy to read, mathematical notation by selecting
Formatted Equations from the Windows menu. The result is shown in Figure 1-24. Notice that,
by default, the comments enclosed by quotations are shown in the Formatted Equations Window
while those enclosed by curly brackets are not shown. All comments can be turned off by right
clicking in the Formatted Equations Window and de-selecting the Display Comments option
from the pop-up menu.

Figure 1-24: Formatted Equations Window.

The Formatted Equations window is particularly useful for viewing large equations with multiple
parentheses. For example, consider the equation:

 1.25 64 3.44 
   
4  3.44 4 L 4 L

f    (1-10)
ReD  0.00021 
 L 1 
 L  
2


Equation (1-10) is the correlation provided by Shah and London (1978) for the average friction
factor associated with developing flow in a round tube. The symbol ReD is the Reynolds number
and L+ is the dimensionless length of the tube. This correlation can be entered in the Equations
24 Chapter 1: Introduction to EES

Window as shown below. Note that Chapter 12 discusses the EES heat transfer library which
implements this and other useful correlations automatically.

Re_D=1000 "Reynolds number"


L|plus=10 "dimensionless length"
f_bar=(4/Re_D)*(3.44/sqrt(L|plus)+(1.25/(4*L|plus)+64/4-3.44/sqrt(L|plus))/(1+0.00021/L|plus^2))
"average friction factor"
sigma=1 "a Greek symbol"

The equation for f is difficult to read or debug in the word processing format used by the
Equations Window. It is much easier to view in the Formatted Equations Window, as shown in
Figure 1-25.

Figure 1-25: Formatted Equations Window.

Notice that the symbol f_bar is interpreted as f with an overbar in the Formatted Equations
Window. Similarly Re_D is interpreted as Re with a subscript D and L|plus is interpreted as L
with a superscript +. Greek symbols are also interpreted correctly; notice that the variable sigma
is interpreted as . The formatting options that are available are summarized in Table 1-3.
Section 1.6 shows how equations in the Formatted Equations Window can be copied in various
formats in order to facilitate writing reports or papers.

Table 1-3: Variable display options for Formatted Equations Window.


Description Method Example of variable in Result in the Formatted
Equations Window Equations Window
Overbar append _bar to the variable X_bar X
Tilde append _tilde to the variable X_tilde X
Hat append _hat to the variable X_hat X̂
Dot append _dot to the variable X_dot X
Double dot append _ddot to the variable X_ddot X
Single prime append _prime to the variable X_prime X
Double prime append _dprime to the variable X_dprime X 
Subscript use the _ to start the subscript X_a Xa
Superscript use the | to start the superscript X|a Xa
Infinity symbol spell out infinity X_infinity X
delta 
Greek symbol spell out the name of the symbol
DELTA 
Chapter 1: Introduction to EES 25

The Splitter Bar


In a large EES program, you may also find it convenient to be working on one section of the
code while viewing another. Professional versions of EES provide this capability using the
splitter bar. The splitter bar divides the vertical scroll bar into two sections. The position of the
splitter bar is indicated by the red rectangle on the vertical scroll bar. Initially, the splitter bar is
at its uppermost position, indicating that the vertical scroll bar has only one section. To see how
the splitter bar works, select EES Example Problems from the Examples menu and then select
Psychrometric functions. Select the EES example named Using psychrometric functions in a
supermarket model. This example is a relatively large EES program and it is possible that you
may want to use the splitter bar to work on it. Select the red rectangle and adjust its position to
create two sections, as shown in Figure 1-26.

Figure 1-26: Splitter bar used to create two sections.

Password Protection
In the Professional version of EES, it is possible to password protect the Equations Window so
that only you can edit it. Right click in the Equations Window and select Protected from the
resulting pop-up menu. You will be prompted to enter and then re-enter a password, after which
the background color will change to indicate that the text is now read only. Any subsequent
attempt to edit the protected regions of the Equations Window will not be allowed until you
unprotect the text. The text can be unprotected by right clicking on it and selecting Protected, at
which time you must enter the password.
26 Chapter 1: Introduction to EES

Key Variables
The Solution Window in a large EES program will contain many variables. Variables are listed
in alphabetical order; however, it may be difficult to quickly and easily identify the small subset
of variables that are of particular interest. To focus attention on a particular variable, it is
possible to highlight its appearance. For example, open the example file named Dinner.ees
located in the Userlib\Examples folder within the folder containing the EES application. (In the
64-bit version, the file will be named Dinner.ees64 and located in the \Userlib64\Examples
folder.) You can access the example directly by selecting Getting Started with EES from the
Examples menu at the right of the menu bar and then selecting “Settling the bill”. Solve the
equations by pressing F2 and the Solution Window should appear. Select the variable Debbie in
the Solution Window and right-click on it. The Specify Format and Units dialog that appears is
shown in Figure 1-27.

Figure 1-27: Specify Format and Units dialog.

The Specify Format and Units dialog allows you to change the formatting that is used to display
the variable in the Solutions Window. For example, you can box the variable and change its
background color. You can also select a subset of all of the variables in your Solution Window
and make them key variables. Select the variable of interest by clicking the mouse on it (or by
pressing the Tab key until the variable is selected). Then either press the Return key or press the
right mouse button. This action will display the Specify Format and Units dialog. Click the Key
Variable check box and an edit box will appear in which you can write some descriptive
comments about the variable, as shown in Figure 1-28. Select OK and you will see that a new
tab will appear in the Solutions Window allowing access to the Key Variables Window. All of
the variables that have been identified as key variables are placed in the Key Variable Window
together with their associated descriptive comments, as shown in Figure 1-29. The position of
each line in the Key Variable Window can be changed dragging the mouse, i.e., pressing and
holding the mouse button down on the desired line while moving the mouse to the new location.
Chapter 1: Introduction to EES 27

Figure 1-28: Key Variable.

Figure 1-29: Key Variables Window.

Note that you can customize the Key Variables window in several ways. Clicking the right
mouse will bring up a pop-up menu, as shown in Figure 1-30, that allows text, separators
(horizontal lines) and text centered within a separator to be added, edited or deleted. The first
menu command will differ depending on where the mouse was clicked. (In Figure 1-30, the
mouse was clicked on the text with separator). Text, headers, separators and new Key variables
initially appear above the item that receives the mouse click. Clicking at the bottom of the
window below all other items allows new items to be entered at the bottom of the list. However,
the order in which the items initially appear is not fixed. All items in the Key Variables window
can be 'dragged' to a different location by pressing and holding the left mouse down on the item
that is to be moved while moving the cursor up or down, as illustrated in Figure 1-31.

Figure 1-30. Right-click in the Key Variables window to bring up a popup menu.
28 Chapter 1: Introduction to EES

Figure 1-31: Items in the Key Variables window can be 'dragged' to a different position.

1.3 Parametric Tables


Section 1.2 described how to use EES to obtain a single solution to a set of equations. It is often
interesting to run a parametric study in which the effect of one variable (the independent
variable) on another variable (the dependent variable) is studied. For example, let's estimate the
pressure loss incurred by the flow of water through a 45º elbow as a function of the flow rate.
The inner diameter of the elbow is D = 2 cm and the density of water is  = 1000 kg/m3. The
dimensionless resistance coefficient for this type of elbow is estimated to be K = 0.3. The
pressure loss can be estimated according to:

 u2
P  K (1-11)
2

where u is the velocity of the water. The inputs are entered in the Equations Window; note that
we'll start with V = 100 liter/min and subsequently vary this value.

$TabStops 2.5 in

"Inputs"
K=0.3 "K factor for a 45 degree elbow, dimensionless"
V_dot=100 [liter/min] "volumetric flow rate
D=2 [cm] "inner diameter of elbow
rho=1000 [kg/m^3] "density of water" 

In Section 1.5, we will discuss how EES can help you deal with unit assignments and
conversions. For now we'll have to keep track of units manually. Notice that the units assigned
to each variable are indicated in the associated comment. The cross sectional area of the elbow
is given by:

D2
Ac   (1-12)
4
Chapter 1: Introduction to EES 29

The variable pi# is a built-in constant in EES corresponding to the value of  (other built-in
constants are discussed in Section 1.9). The units of the variable A_c will be most useful if
converted from cm2 to m2. (See section 1.5 for details concerning unit conversion.)

A_c =pi*D^2/4*convert(cm^2,m^2) "cross-sectional area for flow"

The velocity of the water is:


V
u (1-13)
Ac

As written, the units for the variable u must be liter/min (the units for the variable V_dot) divided
by m2 (the units for the variable A_c). Therefore, the units for u must liter/min-m2. Note that in
this book, the hyphen sign will be used to indicate multiplication on one side of the divisor in the
liter
context of units; therefore liter/min-m2 should be read as . EES uses the same
min m 2
convention for unit specifications, although the hyphen can be replaced with a space or a dot
(Alt-250 on a U.S. keyboard).

The units for the variable u, as calculated, are not useful; let's convert the units to m/s, which are
more reasonable:
liter 1m3 min m
2
 0.00001667 (1-14)
min-m 1000 liter 60 s s
The EES code, with the unit conversion, is:

u=V_dot*convert(liter/min,m^3/s)/A_c "velocity, in m/s"

Finally, Eq. (1-11) is used to compute the pressure loss.

DELTAP=K*rho*u^2/2 "pressure loss”

Again, the units for the variable DELTAP don't make a lot of sense; as calculated, the units are
(kg/m3)(m/s)2. Let's convert to kPa, which are more commonly used:
kg m 2 0.001 kPa
=0.001 kPa (1-15)
m3 s 2 kg/m-s 2
Notice that we had to look up four separate unit conversion factors in order to accomplish the
unit conversion indicated by Eq. (1-15). Section 1.5 shows that EES greatly reduces the hassle
and potential errors that are associated with working with units.

DELTAP=K*rho*u^2/2*convert(kg/m-s^2,kPa) "pressure loss, in kPa"

Solving leads to P = 4.22 kPa for V = 100 liter/min.


30 Chapter 1: Introduction to EES

Creating a Parametric Table


In order to parametrically vary the volumetric flow rate (the independent variable) and study its
effect on the pressure loss (the dependent variable) we need to create a Parametric Table. Select
New Parametric Table from the Tables menu. The New Parametric Table dialog will appear, as
shown in Figure 1-32.

Figure 1-32: New Parametric Table dialog.

The window on the left side of the dialog provides a list of all of the variables that are included
in the Equations Window. Highlight the independent and dependent variables of interest (in this
case, the variables V_dot and DeltaP) by clicking on them and then select Add to add the variables
to the window on the right side, which lists variables to be included in the table. Any other
variables that you wish to include in the table can also be added. You can select the variables
one at a time or all at once. Select OK in order to create the Parametric Table, shown in Figure
1-33. By default, there are 10 runs (rows) in the table. Runs can be added or removed by
selecting Insert/Delete Runs from the Tables menu or by right-clicking on any run number and
selecting Insert Runs or Delete Runs. There is a column for each of the variables included in the
table. Columns can be added or deleted by selecting Insert/Delete Vars from the Tables menu or
right clicking on any variable and selecting Insert Column or Delete.

Figure 1-33: Empty Parametric Table.


Chapter 1: Introduction to EES 31

Alter Values
To carry out a parametric study in which the volumetric flow rate is changed, it is necessary to
fill in the column for the variable V_dot with flow rate values that are of interest. This process
can be done manually, one run at a time. More typically, you will right-click on the column of
interest and select Alter Values or click on the triangular icon in the column header to bring up
the dialog shown in Figure 1-34.

Figure 1-34: Alter values dialog.

Select the rows to be filled in (rows 1 to 10, for this example) and the pattern to be used to enter
the values. In Figure 1-34, the dialog is filled in so that the volumetric flow rate varies from 200
liter/min (in row 1) to 2000 liter/min (in row 10) in equally spaced intervals, as shown in Figure
1-35. Other options can also be specified by clicking on the drop down menu under First Value.
For plots that will use a logarithmic scale, the selection Last (Log) is particularly useful as it
logarithmically spaces the values in the table.

Figure 1-35: Parametric Table with values of V_dot set.

In the Professional version, the value entered for Last Row (upper left of Figure 1-34) can be set
to value greater than the current number of rows in the Parametric table. After confirmation,
EES will extend the number of rows in the table to this value. The Professional version also
allows EES variables (in addition to numerical values) to provide the First Value Last/Increment
values.
32 Chapter 1: Introduction to EES

Solving a Parametric Table


The Parametric Table is solved and filled in using the Solve Table command from the Calculate
menu (or by pressing F3). Solving the table prompts EES to solve one or more of the runs in the
table. EES will begin with the first run that is specified and look in the table to see which
columns have specified values. It will then specify the value of these variables in the Equations
Window, solve the resulting system of equations, and fill in the values of the remaining columns
based on the solution. Select Solve Table to bring up the Solve Table dialog shown in Figure 1-
36.

Figure 1-36: Solve Table dialog.

The dialog is initially set so that EES will start with run 1 and end with run 10. By pressing OK,
EES will go to run 1 of the Parametric Table shown in Figure 1-35 and find that the value of the
variable V_dot is set to 200. Therefore, you can imagine that EES places the following equation
in the Equations Window.

V_dot=100

Of course, this presents a problem because the statement:

V_dot=100 "volumetric flow rate, in liter per min"

already exists in the Equations Window. The variable V_dot cannot have multiple values as it
causes the equation set to be over-constrained (8 equations and 7 variables). Solving the table
will result in the error dialog shown in Figure 1-37.

Figure 1-37: Error dialog.


Chapter 1: Introduction to EES 33

This problem can be alleviated by commenting out the equation that specifies the volumetric
flow rate in the Equations Window. Highlight the statement, right-click, and select Comment {}
in order to temporarily remove it from the equation set.

{V_dot=100 "volumetric flow rate, in liter per min"}

Now solve the table to obtain the solved Parametric Table shown in Figure 1-38.

Figure 1-38: Solved Parametric Table.

It will sometimes be useful to solve only a portion of the table. This is easily accomplished by
changing the first and last run numbers in the Solve Table dialog.

All tables in the Professional version are equipped with a column-sizing control that
automatically sets the required width of the columns in the table. The control is a double-headed
arrow appearing in the upper left cell of the table, as shown in Figure 1- 39. When it is not
enabled, the arrowheads are gray-filled as seen in Figure 1- 39a. Clicking on the control resizes
the columns so that contents of the column just fit. The arrowheads will then be filled with a
light blue color, Figure 1- 39b. Holding the Ctrl key while clicking on the control returns the
column widths to their default size.
34 Chapter 1: Introduction to EES

Figure 1- 39: Parametric table in Professional version showing column sizing control a) off and b) on

In the Professional version of EES, the start and stop values can be set to variables. For
example, add the lines:

startrow=3 "first run"


endrow=7 "last run"

Open the Parametric Table, right click on the DeltaP variable column and select Alter Values.
Select Clear Values to clear the column. Solve the table again. This time, click on the arrow
next to First Run Number and change it to First Run Variable and then select startrow. Change
Last Run Number to Last Run Variable and select endrow. The result is shown in Figure 1-40.
Select OK and you will see that only runs 3 through 7 have been filled in.

Figure 1-40: Solve Table dialog with first and last runs set with variables.
Chapter 1: Introduction to EES 35

Formatting Columns
The Parametric Table shows the value of pressure drop for each corresponding value of
volumetric flow rate. In Section 1.4 we will see how to use this information to prepare a plot.
Before we do that, let's look at some other features of Parametric Tables. The position of the
columns can be adjusted by dragging (i.e., pressing the left mouse button and then moving
mouse while holding down the mouse button) the column headers. The units, alternate units ,
and format of the columns can be adjusted by right-clicking on the column and selecting
Properties to bring up the Format Properties Table dialog shown in Figure 1-41 (for the column
corresponding to the variable DELTAP). The format used to display the results, the background
color, and the column width can also be adjusted. The column number can also be set in this
dialog. At the bottom of the dialog, statistics are provided for the entries in the column.

Figure 1-41: Format Properties Table dialog.

The $If, $IfNot, $Else, and $EndIf Directives


In order to run the Parametric Table we had to comment out the line in the Equations Window
that specified the value of the variable V_dot. This change temporarily removes the specification;
it can be returned by highlighting the text, right clicking, and selecting Undo Comment {} from
the pop-up menu.

V_dot=100 "volumetric flow rate, in liter per min"

A more elegant method for removing one or more lines of code when a Parametric Table is being
solved is to use the $If directive. The $If directive is used according to:

$If Condition
line(s) of code to be executed if Condition is true
36 Chapter 1: Introduction to EES

$Else
line(s) of code to be executed if Condition is false
$EndIf

where Condition is a keyword that indicates an execution condition. There are many such
keywords recognized by EES and these are discussed in more detail in Chapter 14. One
keyword is ParametricTable, which evaluates to true when the equations are being solved from a
Parametric Table. For our problem, we want to specify the value of the variable V_dot in the
Equations Window only if the value of ParametricTable is false:

$If ParametricTable
$Else
V_dot=100 "volumetric flow rate, in liter per min"
$EndIf

Alternatively, we could use the $IfNot directive according to:

$IfNot ParametricTable
V_dot=100 "volumetric flow rate, in liter per min"
$EndIf

You should find that your equation set now runs if you select either Solve or Solve Table from
the Calculate menu (or if you press either F2 or F3, respectively).

Naming and Documenting Parametric Tables


The Parametric Table can be renamed and annotated. Right click on the tab corresponding to the
table in order to bring up the Information for Parametric Table dialog, shown in Figure 1-42.
Provide a descriptive name in the Title bar (DP) and record the details of the calculation in the
Description panel. The description can optionally be printed with the table.

Figure 1-42: Information for Parametric Table dialog.


Chapter 1: Introduction to EES 37

Saving and Loading Parametric Tables


The Parametric Table is automatically saved with the EES program and reloaded when the
program is reopened. However, you can also save your Parametric Table independently by
selecting Save in the Information for Parametric Table dialog (Figure 1-43), which is accessed
by right-clicking on the tab name for the table.

Figure 1-43: Right-click on Parametric Table tab to bring up this dialog.

The table can be saved as a text (.txt) or comma separated values (.csv) file; either of these file
formats can be opened by most any other software or spreadsheet Section 1.8 provide details on
Lookup File formats. The table can also be saved in a format that can be reopened by a different
EES program as a Lookup Table (.lkt). Lookup Tables are discussed in Section 1.8. Finally,
data can also be saved as an .xlsx file using the Save Table command in the Tables menu to
allow exporting to Excel. In this case, the first row in the Excel file will be the name of the
column. The second row will be the units. The data in the table will start in the third row.
Lookup files saved in the format can be opened with the Open Lookup Table command. Note
that a Parametric table can also be saved as a .PAR file using the Store Parametric Table
command in the Tables menu. A .PAR file can only be read by EES. This format is useful if
you wish to move a Parametric table to another EES file.

Deleting Parametric Tables


Parametric tables are saved with an EES file. They can be saved independently as explained in
the previous section. A Parametric table can be deleted in two ways. One way is to right-click
on the window tab to bring up the dialog window shown in Figure 1-43. Click the Delete button,
A second way to delete one or more Parametric tables is the Delete Parametric Tables command
in the Tables menu. Selecting this command will bring up the dialog window shown in Figure 1-
44 which lists all Parametric tables. Click the tables that are to be deleted, which will place a
check mark before the table name and then click the Delete button. Note that deleting the
Parametric table means that the data that it contains will not be saved with the EES file the next
time the EES file is saved. However, the Delete command does not delete a Parametric table file
that has been saved separately in an .lkt, .txt, .csv, .par or other file format.
38 Chapter 1: Introduction to EES

Figure 1-44: The Delete Parametric Tables dialog

Copying Information from a Parametric Table


A range of cells from the table can be copied to a temporary memory location called the
“clipboard” and pasted into other tables in EES or other applications, such as a word processor or
a spreadsheet. For example, highlight the cells between rows 3 and 7 by clicking in upper left
cell, and the pressing and holding the Shift key down while clicking in the lower right cell.
Next, right click to bring up the pop-up menu shown in Figure 1-45.

Figure 1-45: Pop-up menu.

Select Copy to place the information on the clipboard. Open another spreadsheet or word
processor and then paste the information. The result is shown in Figure 1-46(a) using Excel. If
the Copy with Headers option is selected then the header for each column is also copied; the
result is shown in Figure 1-46(b). Notice in both cases that the number of significant figures
associated with the data that is copied corresponds to the number of significant figures used to
display the information in the Parametric Table. If the Copy (E-format) option is selected then
the data are copied with 12 significant figures so that there is no loss of accuracy associated with
the copy/paste operation, as shown in Figure 1-46(c). The Copy Alt units command will copy
the numerical data in selected section of the table in the alternate units, if they are defined.
Otherwise, it will just act as the Copy command.

When the Copy command is issued, EES actually copies the data to the clipboard in two formats.
The first format uses the number of significant figures that are displayed and this is what appears
Chapter 1: Introduction to EES 39

in an external program. In the second format, EES retains all of the significant digits. If you
paste data from one column of a table to another (or to any other table in EES), EES will paste
the data with all of the significant figures so there is no loss in precision during the copy process.

(a) (b) (c)


Figure 1-46: Information pasted into Excel using (a) Copy, (b) Copy with Headers, and (c) Copy (E-format)
commands.

1.4 Basic Plotting


Section 1.3 described how to create a Parametric Table that includes the value of a dependent
variable at each of several values of an independent variable. This information is viewed most
conveniently in the form of a plot. EES allows the generation of several types of plots, as
discussed in Chapter 9. In this section, only the most basic X-Y type plot is discussed. Data
contained in the Parametric Table created in Section 1.3 will be plotted in this section. Data
contained in Lookup Tables (see Section 1.8), Arrays (see Section 1.7), and Integral Tables (see
Chapter 7) can also be used for this purpose.

Generating a Plot
To generate a plot, select New Plot Window from the Plots menu in order to access the New Plot
Setup dialog shown in Figure 1-47. At the top of the dialog you can provide a title (in the Tab
Name field) and some descriptive text. The upper right portion of the dialog is used to select the
source of the data; here it is a Parametric Table and the title of the table is DP. (Not that the New
Plot Setup window width can be increased by dragging the right side if needed to display long
table names.) As shown in Figure 1-47, the New Plot dialog is set up to plot all 10 rows in the
table but it is also possible to plot only a subset of the rows. The two windows in the dialog
allow you to specify the independent (X-Axis) and dependent (Y-Axis) data. Figure 1-47 shows
the New Plot dialog set up to plot the pressure loss as a function of the flow rate. Select OK to
create the plot, which is shown in Figure 1-48.

Note that in the Professional version, variables may be plotted in their base or alternate set of
units. Alternate units can be entered in the Format Table dialog, as shown in Section 1.5.
40 Chapter 1: Introduction to EES

Figure 1-47: New Plot Setup dialog.

Figure 1-48: Pressure loss as a function of flow rate.


Chapter 1: Introduction to EES 41

Modifying Axes
Almost every aspect of the plot can be modified in order to customize or improve it. A detailed
discussion of plotting options is provided in Chapter 9. Some of the common options are
described in this section.

Double-click (or right-click) on either axis label to bring up the Format Text Item dialog. You
can change the axis label to a descriptive text with units and change the font. A gray triangular
icon is visible at the bottom right of the plot when the plot toolbar is visible. You can resize the
plot by selecting the gray triangle in the bottom right-corner and holding the mouse button down
on the icon while moving the mouse to an alternative location. Note that the size of all text and
graphic items in the plot changes in proportion to the size of the plot unless the Ctrl key is held
down during this process. The axis scale can be adjusted by placing the mouse over any of the
axes (left, right, bottom, or top) and clicking the right mouse button. This action will bring up
the Modify Axis dialog shown in Figure 1-49, which allows you to make adjustments in the axis
scale, add grid lines, etc.

Figure 1-49: Modify Axis dialog.

An improved plot of pressure loss as a function of flow rate is shown in Figure 1-50(a). By
selecting the Automatic scaling option in the Modify Axis dialog, the axis scale will be
automatically adjusted to encompass the data being presented. The axis labels can be scaled by a
factor of 10, 100, 1000, etc. by adjusting the Scale by 10^ option; Figure 1-50(b) shows the result
of scaling the labels by 100 (102). Select the top to bottom option in the Modify Axis dialog in
order to invert the scale, as shown in Figure 1-50(c).
42 Chapter 1: Introduction to EES

x 102
2000 18

1800 16

1600 14

Pressure loss (kPa)


Pressure loss (kPa)

1400
12
1200
10
1000
8
800
6
600
4
400

200 2

0 0
0 200 400 600 800 1000 1200 1400 1600 1800 2000 0 200 400 600 800 1000 1200 1400 1600 1800 2000
Flow rate (liter/min) Flow rate (liter/min)
(a) (b)

200

400
Pressure loss (kPa)

600

800

1000

1200

1400

1600

1800

2000
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Flow rate (liter/min)
(c)
Figure 1-50: Improved plot of pressure loss as a function of flow rate (a) with default y-axis format, (b) with
y-axis scaled by a factor of 102, and (c) with y-axis scaled from top-to-bottom.

Note that the range of values included on the X or Y axis can also be changed without use of the
Modify Axis dialog. This is done by simply positioning the mouse cursor on an axis and
dragging it. For example, if you wish the starting value of Flow rate shown in Figure 1-50 to be
less that 0, move the mouse over the left Y axis. The cursor will change to a  . Press and hold
the left mouse button while moving the most slightly to the left. Release the mouse when the
axis is in the desired position.
Chapter 1: Introduction to EES 43

Overlaying Plots
Multiple data series can be overlaid onto the same plot. Change the resistance coefficient to K =
0.4 and run the Parametric Table again. Select Overlay Plot from the Plots menu in order to plot
pressure loss as a function of flow rate for the adjusted value of K. Your plot should now have
two sets of data, as shown in Figure 1-51.
2000 2000

1800 1800

1600 1600
Pressure loss (kPa)

Pressure loss (kPa)


1400 1400

1200 1200

1000 1000

800 800

600 600

400 400

200 200

0 0
0 200 400 600 800 1000 1200 1400 1600 1800 2000 0 200 400 600 800 1000 1200 1400 1600 1800 2000
Flow rate (liter/min) Flow rate (liter/min)
(a) (b)

2000

1800

1600
K = 0.4
Pressure loss (kPa)

1400

1200 K = 0.3

1000

800

600

400

200

0
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Flow rate (liter/min)
(c)
Figure 1-51: Plot with two data series (a) unmodified, (b) with error bars, and (c) with text annotations.

Modifying Plots
Double click (or right click) anywhere on the plot (other than on a text or graphic item) in order
to access the Modify Plot dialog shown in Figure 1-52. This dialog allows you to add and adjust
grid lines and modify the border and size of the plot. The upper window lists all of the data
series that appear in the plot. You can delete one or more of these series by selecting Delete
44 Chapter 1: Introduction to EES

button. The underlying data set that is used in the plot to can be extracted to a Lookup Table by
selecting Get Data button. The characteristics of each data series (e.g., the line thickness, color,
symbols, etc.) can be adjusted. The Smoothing option allows you to adjust the line passing
through the data using either a cubic spline, polynomial fit, or moving average.

The parameters in the Border box allow setting of the upper left corner of the plot and its width
and height. These width and height can also be changed by dragging the lower right corner of
the plot with the mouse button depressed. However, the setting here allow all plots to have the
same size and position .

Figure 1-52: Modify Plot dialog.

At the bottom left of the Modify Plot dialog, controls are provided to allow data to be placed on
the primary (X1 and Y1) or secondary axes (X2 and Y2). The primary axes are shown at the
bottom (X-axis) and left (Y-axis) of the plot. The secondary axes are initially shown at the top
(X-axis) right (Y-axis), but they can be moved anywhere as detailed in section 9-1.

The controls at the bottom right allow the X and Y axes to exchange position and set the
background color of the plot rectangle. By default, the plot rectangle has a white background.
Clicking in the box to the right of Background color will bring up a color dialog that allows any
background color to be selected.
Chapter 1: Introduction to EES 45

Automatic Update
The Automatic update option in the Modify Plot dialog causes the data series to be re-plotted
each time the data source changes (e.g., the data in the Parametric Table are adjusted). This
option is useful if you want to adjust parameters in your model and immediately see how they
affect a plotted result. Once the Automatic update option is selected, the Data button becomes
live. Clicking this button will bring up the Modify Automatic Plot Data dialog, which allows
you to adjust the range of data that is plotted. Note that this dialog provides a check box for All
rows in table. If this box is selected, the range of plotted data will automatically change as the
number of rows of data change. If this option is not checked, then only the specified rows will
be updated.

Figure 1-53: Modify Automatic Plot Data after clicking the Data button.

Error Bars
Select Y-axis in the Modify Plot dialog to bring up the Specify Error Bar Information dialog
shown in Figure 1-54(a). The error bars can be set according to either an absolute or relative
uncertainty. Select an Absolute uncertainty of 50 kPa for the y error bar. Repeat the process for
the x error bar using an uncertainty of 50 liter/min in order to generate the plot shown in Figure
1-51(b). Alternatively, the uncertainty values used to generate the error bars can be obtained
from a table. It is also possible to generate asymmetric error bars by de-selecting the Identical
upper and lower values option in the Specify Error Information dialog, which brings up a
separate window for selecting the upper and lower uncertainty values, as shown in Figure 1-
54(b).
46 Chapter 1: Introduction to EES

(a) (b)
Figure 1-54: Specify Error Bar Information dialog (a) with identical upper and lower values, and (b) with
different upper and lower values.

The Plot Tool Bar


The plot tool bar (Figure 1-55) should be visible in the plot window; if not, select Show Tool Bar
from the Plots menu.

Figure 1-55: Plot tool bar.

Selecting the text tool opens the Format Text dialog, shown in Figure 1-56(a). You can type
text into the window in order to annotate your figure, as was done in Figure 1-51(c). The size,
font, style, and background of the text can be selected with the controls in this dialog. Clicking
the or button will change the selected text in the text field into a subscript or superscript,
respectively. For example, to enter Tinitial, type Tinitial into the text field. Then select initial and
click the button. The text field will change to T\dinitial\. The \d instructs EES to display the
following text up to the next \ as a subscript. \u in place of \d will result in a superscript. You
can enter these codes directly, without using the buttons if you prefer. Clicking the button
will insert a line break, carriage return code in the text string which will appear as \m in the text
edit box. When this option is selected, a check box will appear offering the option of centering
the lines of text with respect to each other.
Chapter 1: Introduction to EES 47

In the Professional version, you can also link the position of the text to a certain data point using
the Link Text to Data Point in Plot option at the bottom of Figure 1-56(a). This capability is
particularly useful if you have a plot that is automatically updated as you change parameters and
you would like the annotations to remain in their correct locations with respect to the data series.

(a) (b)
Figure 1-56: Format Text dialog with (a) Text item and (b) EES variable selected.

By default, the text tool is set to place a text item onto the plot; therefore the Text item radio
button is filled in at the top of the dialog. However, you can also annotate the plot using the
value of an EES variable by selecting the EES variable radio button. The resulting dialog is
shown in Figure 1-56(b). Use the pull down menu to select the appropriate variable (in our case
K). If the radio button Show name is selected, then both the value and the name of the variable
will be shown. If the Show units radio button is selected, then the units of the variable will also
be shown provided that they are set, as discussed in Section 1.5. The Integral radio button
automatically integrates one of the data series shown in the plots (selected by the user from a
dropdown menu) and places the value on the plot.

Note that strings of international characters can be displayed on the plot by entering the string in
the text box. EES will automatically detect if the entered text contains international characters.
If so, a blue (International Characters in use) message will appear under the text, as shown in
Figure 1-57. The subscript, superscript, and symbol buttons are disabled when international
characters are used. Also, a background color can be set for any text item, as shown in Figure 1-
57.
48 Chapter 1: Introduction to EES

Figure 1-57: Using international text in the Plot window

There are several other useful tools in the Plot tool bar shown in Figure 1-55. The line tool
allows you to draw lines on your plot. By holding the shift key down during the drawing
process, the lines are constrained to horizontal, vertical, or 45°. The polyline tool allows you
to draw a series of connected lines. The square , circle , and polygon tools allow
rectangular, circular, and polygon regions to be outlined on the plot (note that the polygon tool is
only available in the Professional version). Holding the Shift key down while drawing these
objects forces them to have a constant aspect ratio.

When the plot tool bar is visible you can also copy graphic objects from other applications (e.g.,
PowerPoint®) and paste them into the plot window. The elbow shown at the bottom right of
Figure 1-58 was inserted in this manner. Right click on any of the objects on a plot in order to
change its properties (e.g., to add arrows to lines or to shade regions in opaque or semi-
transparent colors) or move objects forward (in front of) or backwards (behind each other) each
other. Select multiple objects at once by clicking on them one by one while holding the Shift
key down. Alternatively, you can select a rectangular region on the plot by pressing and holding
the left mouse button down at the upper left corner of the region and moving the mouse to the
lower right corner of the region. All objects within the region will be selected. The properties of
all selected objects can be changed at once.
Chapter 1: Introduction to EES 49

The alignment tool will be activated when multiple objects are selected. The alignment tool
can be used to align the positions of a group of selected objects vertically and/or horizontally.
Figure 1-58 shows a carefully formatted plot of pressure loss as a function of flow rate through a
45º elbow calculated using various values of the resistance coefficient. The alignment tool is
also activated when the X or Y-axis label is selected. In this case, the alignment tool can be used
to move the label to the center the axis.

Text and graphic items in Plot windows can be moved with the arrow keys when the Plot tool bar
(Figure 1-55) is visible. When an arrow key is pressed the first time, the selected items will
move 5 pixels. If the key is held down, the selected items will move quickly. Releasing and
pressing the key again (within 3 seconds) will move the selected items by 1 pixel, allowing fine
control. If the arrow key is then held down for more than 3 seconds, the speed at which the
selected items move in the designated direction will increase.

2000

1800

1600 K = 0.4
K = 0.35
Pressure loss (kPa)

1400
K = 0.3
1200
K = 0.25
1000 K = 0.2
800

600

400

200

0
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Flow rate (liter/min)
Figure 1-58: Formatted plot of pressure loss as a function of flow rate through a 45º elbow for various values
of the resistance coefficient.

The Cross-Hairs, Move, and Zoom Tools


The cross-hairs tool brings up a status bar at the bottom of the plot showing the x and y
coordinates of the cursor, as shown in Figure 1-59. See Chapter 9 for a discussion of additional
capabilities of the cross-hairs tool.

The plot is normally locked in position in the plot window. However, it can be moved using the
Move plot tool (it can also be moved if the Ctrl key is held down). This tool is particularly
useful if the plot is located too close to the left or top of the plot window.

The Zoom tool allows a rectangular region of the plot to be selected, as shown in Figure 1-
60(a). A new plot is subsequently created, as shown in Figure 1-60(b), which includes the
selected region and therefore provides a zoomed in view of a certain region of the original plot.
50 Chapter 1: Introduction to EES

Figure 1-59: Plot window with cross hairs and status bar (at bottom).

(a) (b)
Figure 1-60: (a) Plot with the zoom feature activated and (b) new plot with zoomed in region.
Chapter 1: Introduction to EES 51

1.5 Units
In Section 1.3 we calculated the pressure loss through a 45º elbow. During the process of
solving the problem we found that it was tedious keeping track of the units of each variable and
converting between different units. Variables in engineering problems typically represent
physical quantities and therefore they will have units. EES allows you to assign not only a value
to each variable, but also its units. This is an incredibly useful feature of EES because the unit
consistency of the equations will be examined by EES and any unit conversion errors will be
flagged. Further, EES facilitates the process of converting between units by including a large
number of built-in unit conversion factors. EES can also display variables in dual units.

Unit System
Units are commonly categorized as belonging to the English or SI (Systems International) unit
system. If you are accessing any of the built-in thermodynamic or transport property functions
or any of the trigonometric functions in EES, then it is important that you specify the units
system that you will be using. This is done by selecting Unit System from the Options menu to
access the Unit System tab of the Preferences dialog, shown in Figure 1-61. You can select
which unit system (English or SI) you will be using. Most of the settings in this page become
important only when accessing property databases, as discussed in Chapter 4. In the section
labeled Trig functions you must specify whether you want to provide arguments to trigonometric
functions in radians or degrees.

Figure 1-61: Unit System dialog.

Entering Units
Let's return to the example from Section 1.3. The inner diameter of the elbow is D = 2 cm and
the density of water is  = 1000 kg/m3. The dimensionless resistance coefficient is estimated to
be K = 0.3, allowing the pressure loss can be estimated according to:

 u2
P  K (1-16)
2
52 Chapter 1: Introduction to EES

where u is the velocity of the water. We will compute the pressure loss when the volumetric
flow rate is V = 100 liter/min. The inputs are entered in EES as before:

$TabStops 0.2 2.5 in

"Inputs"
K=0.3 "K factor for a 45 degree elbow, dimensionless"
D=2 "diameter"
rho=1000 "density"
V_dot=100 "flow rate"

Solve the equations and examine the Solution Window, shown in Figure 1-62(a). The value of
each variable is indicated, but no units have been set.

(a) (b)
Figure 1-62: Solutions Window showing input parameters (a) with no units set and (b) with units set.

There are several ways to set the units (and alternate units) of each variable. The units of a
numerical constant (e.g., 2 or 1000) can be set directly in the Equations Window by placing the
unit within square brackets directly after the value. The units of each input variable can
therefore be set as they are entered.

$TabStops 0.2 2.5 in

"Inputs"
K=0.3 [-] "K factor for a 45 degree elbow, dimensionless"
D=2 [cm] "diameter"
rho=1000 [kg/m^3] "density"
V_dot=100 [liter/min] "flow rate"

The resulting Solutions Window is shown in Figure 1-62(b). Both the value and units for each
variable are indicated. Notice that using the hyphen alone as a unit specification indicates that
the variable K is dimensionless (i.e., it has no units). A space could be used in place of the
hyphen. The units for each variable can also be set by right-clicking on the variable in the
Solution Window in order to access the Specify Format and Units dialog, shown in Figure 1-63
for the variable D.
Chapter 1: Introduction to EES 53

Figure 1-63: Specify Format and Units dialog.

It is also possible to set the units of a variable directly from the Equations window. This is done
by clicking on the variable name in the Variable Information palette. This action will bring up
the Variable Information dialog for the selected variable.

Finally, the units for each variable can be set in the Variable Information dialog that is accessed
by selecting Variable Info from the Options menu (or by pressing F9 or right-clicking the Update
button in the Variable Information palette).

Dual Units
Note that two fields are provided for units in Figure 1-63. If a second (alternate) set of units is
provided, it must have the same dimensions as the primary set of units. In this case, EES will
display the variable in the Solution Window in both sets of units. However, only values in the
primary units are used in the calculations. For example, we can enter in (for inches) in the
alternate units field, as seen in Figure 1-64a. Click the OK button and the Solution Window will
appear with the value of D shown both in cm and in inches (Figure 1-64b). EES uses its internal
unit conversion routines to determine the value (shown in brown font) for the second set of units.

Figure 1-64: a) Entering a second set of units and b) Display in the Solutions Window.

Dual units can be made to display in Parametric, Arrays, Lookup, and Integral tables as well. A
field is provided for alternate units in the Format Table dialog shown in Figure 1-41 and Figure 1-
65. This dialog can be made to appear by right-clicking in the header cell in any of the tables and
then selecting Properties from the pop-up menu that appears, as shown in Figure 1-65. Dual units
can be used to create plots with scales for both unit systems as shown in Section 9.1.
54 Chapter 1: Introduction to EES

Figure 1-65: Select Properties to bring up Format Table dialog.

Note that the Format Table dialog has a check box control named ‘Show values in alternate
units’. If an alternate set of units is provided with the same dimensions as the primary set and
this check box is selected, values will be displayed in both units, as seen in Figure 1-66.

Figure 1-66: Parametric table showing values displayed in dual units.

The Professional version allows variables to be plotted in their primary or alternate units. See
section 9.1 for an example of this capability.
Chapter 1: Introduction to EES 55

Units Recognized by EES


The units that EES recognizes can be examined by selecting Unit Conversion Info from the
Options menu in order to bring up the Unit Conversion Information dialog, shown in Figure 1-
67. The left window lists each dimension (e.g., length) while the right window lists the built in
units that are recognized for the selected dimension (e.g., m and ft). If you select two units in the
right window, then EES will display the unit conversion in red at the bottom of the dialog, as
shown in Figure 1-67 for m and ft.

Figure 1-67: Unit Conversion Information dialog.

Checking Units
The cross sectional area of the elbow is given by:

D2
Ac   (1-17)
4

A_c=pi*D^2/4 "cross-sectional area for flow, in cm^2"

By default, EES will not automatically set the units of A_c. Solve the problem and access the
Solution Window, shown in Figure 1-68(a). Notice that there is no unit listed after the variable
A_c and also that a red warning message has appeared at the bottom of the Solution Window
indicating that EES has detected a potential problem with the unit consistency of the equations.

(a) (b)
56 Chapter 1: Introduction to EES

(c)
Figure 1-68: Solution Window with (a) the units of A_c not set, (b) the units of A_c set by the user, and (c) the
units of A_c automatically set by EES.

Select Check Units in order to bring up the Check Units window shown in Figure 1-69. EES has
identified that Eq. (1-17) is not dimensionally consistent if A_c is dimensionless and D has units
cm. It is evident that the units of the variable A_c must be cm2.

Figure 1-69: Check Units Window.

Clicking the left or right mouse button on an equation that has unit issues will bring up the pop-
up menu in Figure 1-70.

Figure 1-70: Options in the Unit Checking Pop-up Menu.

The first menu option will display the formatted equation showing the units of all variables and
constants. This display makes it easy to identify unit problems. The second option will move
the focus to the equation in the Equations window. The third option opens the Variable
Information dialog where the units of one or more variables in the equation can be specified.
The last option disables unit checking for the selected equation.

By default, EES automatically performs this type of unit check each time the system of equations
is solved. Although not recommended, this option can be deactivated by selecting Preferences
from the Options menu and selecting the Options tab to access the dialog shown in Figure 1-71.
Automatic unit checking can also be controlled with the $CheckUnits directive. Placing
$CheckUnits AutoOn at the top of the Equations Window activates automatic unit checking and
Chapter 1: Introduction to EES 57

$CheckUnits AutoOff deactivates it. The $CheckUnits On and $CheckUnits Off directives can be
placed around a set of equations in order to locally deactivate the unit checking for these
equations, as discussed in Section 14.2. The unit consistency of the equation set can also be
checked at any time by selecting Check Units from the Calculate menu (or by selecting F8).

Figure 1-71: Options dialog.

It is not possible to set the units for the variable A_c in the Equations Window using square
brackets because the right side of Eq. (1-17) is not a numerical constant. For example, typing:

A_c=pi*D^2/4 [cm^2] "cross-sectional area for flow"

will result in EES interpreting the constant 4 in the denominator as having units cm2.
Alternatively, typing:

A_c [cm^2] =pi*D^2/4 "cross-sectional area for flow"

will result in EES interpreting the square bracket as the subscript in an array (discussed in
Section 1.7), leading to an error message. Rather, the units of the variable A_c must be set either
by right-clicking on the variable in the Solutions Window and entering the units or by using the
Variable Information window. The result is shown in Figure 1-68(b). Note that the red unit
warning is now gone.

Automatically Setting Units


It is also possible to have EES attempt to discern the appropriate units for each variable based on
the equation in which it is used and then set these units automatically. This is not recommended
as EES is no longer really checking the unit consistency of your equations and variables but
rather forcing unit consistency, if possible, by adjusting the units of the variables. To activate
this option, remove the unit specification for the variable A_c and select Set units automatically
when possible from the Options tab of the Preferences dialog, shown in Figure 1-71. Solve the
equation set to obtain the Solution Window shown in Figure 1-68(c). The units for the variable
2
A_c have been automatically set to cm . The units suggested by EES are automatically indicated
in purple to highlight the fact that these are not user-specified units. All units shown in purple
58 Chapter 1: Introduction to EES

should be confirmed by the user by right-clicking on these variables in the Solutions window and
then making any necessary changes in the dialog window that appears.

Automatic unit setting can also be activated by placing the $AutoSetUnits On directive at the top
of the EES Equations Window:

$AutoSetUnits On

The Convert Function


Let's continue to solve the example problem. The velocity of the water is calculated according
to:

V
u (1-18)
Ac

u=V_dot/A_c "velocity"

As written, the units for the variable u must be liter/min (the units for the variable V_dot) divided
by cm2 (the units for the variable A_c). Therefore, the units for u must liter/min-cm2. (Again,
note that in this book and also in EES, the hyphen sign will be used to indicate multiplication on
one side of the divisor in the context of units). If we set the units for u to liter/min-cm2 in the
Solutions Window, then EES will find no unit inconsistencies. Of course, the units liter/min-cm2
don't make a lot of sense for a velocity and it would be better to convert the value to a more
reasonable set of units, like cm/min. We could do this manually, looking up each of the various
unit conversion factors that are required to arrive at the conclusion that we need to multiply by
1000:

liter 1000 cm3 cm


 (1-19)
min-cm 2 1 liter min

Fortunately, EES has built-in unit conversion information that is easily accessible using the
convert function. The convert function simply retrieves the conversion factor between two units
and therefore the function requires two arguments; the first argument is the unit to convert from
while the second is the unit to convert to. By adding the convert function to the equation
calculating the velocity:

u=V_dot/A_c*convert(liter/min-cm^2,cm/min) "velocity"

the unit conversion is easy and transparent to the user. The convert function returned the correct
unit conversion multiplier (1000) for the unit conversion that is specified by the two arguments.
This is particularly evident in the Formatted Equations Window, shown in Figure 1-72.
Chapter 1: Introduction to EES 59

Figure 1-72: Formatted Equations Window.

The units of the variable u should now correctly be set as cm/min in the Solutions Window or in
the Variable Information dialog. EES will not automatically set the units in this situation.
Finally, Eq. (1-11) is used to compute the pressure loss and the result is converted to kPa:

DELTAP=K*rho*u^2/2*convert(kg-cm^2/m^3-min^2,kPa) "pressure loss"

The units of the variable DELTAP can be set to kPa in the Solutions Window. The unit
assignments of each variable will automatically be stored and the units will be indicated
whenever you use the variables, such in a Parametric Table or plot.

If you set a variable to a numerical constant followed by its units in brackets, EES will
automatically assign the units to the variable. Starting with version 9.437, EES will also
automatically assign the units to variables that have been set to a value using the Convert
command. For example, the following example will set the value of L to 12 and its units to ft.

L=12 [in] * convert(in, ft)

The Units List


The Units List provides a convenient shortcut for entering units that are used often. The units list
is activated by right-clicking in any of the areas where you could otherwise manually enter units;
this includes the Equations Window, the Units field in the Specify Format and Units dialog in the
Solution Window, or the Units column of the Variable Information Window. Select Units List to
access a list of commonly used units, as shown in Figure 1-73. The basic set of units in the list
will depend on whether your unit system is set to English or SI (see Figure 1-61). You can
simply click on the desired unit and select Paste or double click on the unit in order to enter it.
60 Chapter 1: Introduction to EES

Figure 1-73: The default SI Units List.

The unit list can be modified so that it is most useful to you. You really want to include only a
small number of units that you use a lot in order for it to save you time. The buttons to the right
facilitate this process. Units can be added or removed with the Add New and Remove buttons,
respectively. The entire list can be cleared with the Clear button. If you change the units list and
want that change to be recorded beyond the current EES session then you should save the new
file using the Save button.

EES will automatically load the default SI and English units lists (SI_DefaultUnits.unt and
Eng_DefaultUnits.unt, respectively) upon opening. You may have your own, separate units list
that you have developed and would like to use. This is easy to do because the units list is simply
a text file that can be opened and edited with any text editor (e.g., Notepad®). For example,
Figure 1-74(a) illustrates a text file that is saved as MyUnits.unt. This units list can be loaded
using the Load button in Figure 1-73 and then used for the duration of the EES session, as shown
in Figure 1-74(b). Alternatively, a custom units list can be merged with an existing list using the
Merge button.

(a) (b)
Figure 1-74: The unit list saved as (a) MyUnits.unt file and (b) loaded into EES.
Chapter 1: Introduction to EES 61

If you don't want to load your custom units list each time you start EES then you can use the
$INCLUDE directive. The $INCLUDE directive provides an automatic method of loading a variety
of files when you run your EES code. Place the statement:

$INCLUDE MyUnits.unt

at the top of the EES file and you will find that the units list is automatically set as shown in
Figure 1-74(b). Note that regardless of how the units in the units list are organized, they are
simply a subset of the large set of units that are recognized by EES.

Suggested Method for Working with Units


Every engineer should have his or her own, carefully thought out method for dealing with units
and unit conversions. Unit conversion errors are one of the most common mistakes that
engineers make and it is clear that the unit checking and unit conversion features of EES will
help to avoid these problems. The authors have developed a specific procedure for solving
engineering problems that makes unit consistency easy to maintain. Inputs to the problem
reported in arbitrary units will be converted to the base SI system (i.e., kg, m, s, K, N, etc.). The
calculations required to solve the problem will be carried out using the base SI system and unit
checking will be rigorously applied in order to establish the dimensional consistency of each
equation. The results will be converted from the SI system into whatever units are requested or
are logical. This procedure is convenient because the units of each variable are self-consistent in
the SI unit system. It is not necessary to constantly worry about applying the correct unit
conversion to each equation during the development of a model. As a result, if you are working
in the SI unit system and you check the units of your equations then you are actually carrying out
a more powerful and complete check on your equations; you are establishing their dimensional
(as well as their unit) consistency.

Applying this strategy to our pressure loss problem leads to the following equation set:

$TabStops 0.2 2.5 in

"Inputs - converted to base SI units"


K=0.3 [-] "K factor for a 45 degree elbow, dimensionless"
D=2 [cm]*convert(cm,m) "diameter"
rho=1000 [kg/m^3] "density"
V_dot=100 [liter/min]*convert(liter/min,m^3/s) "flow rate"

"Calculations - done in the base SI unit system"


A_c =pi*D^2/4 "cross-sectional area for flow"
u=V_dot/A_c "velocity"
DELTAP=K*rho*u^2/2 "pressure loss"

"Results - converted to convenient units"


V_dot_lpm=V_dot*convert(m^3/s,liter/min) "flow rate, in liter/min"
u_cmpm=u*convert(m/s,cm/min) "velocity, in cm/min"
DELTAP_kPa=DELTAP*convert(Pa,kPa) "pressure loss, in kPa"
62 Chapter 1: Introduction to EES

and the Solution Window shown in Figure 1-75. While it is not necessary that you take this
approach, it certainly makes solving systems of engineering equations much easier. The settings
for the base SI unit system are as shown in Figure 1-61.

Figure 1-75: Solution Window.

Note that EES allows an alternate set of units to be specified for each variable, as shown in
Figure 1-63. The last three lines of the program are not needed if alternate units of liter/min,
cm/min, and kPa are provided for variables V_dot, u, and DELTAP, respectively. The Solution
window with these alternate units set appears as shown in Figure 1-76.

Figure 1-76: Solution Window using alternate units for variables V_dot, u, and DELTAP
Chapter 1: Introduction to EES 63

The ConvertTemp Function


Most unit conversions require only a multiplicative correction that can be provided by the convert
function in EES. However, both multiplication and addition operations are required to convert
between temperature scales. Therefore, the convert function in EES cannot be used to convert a
value from one temperature scale to another temperature scale. Instead, the ConvertTemp
function in EES should be used for this purpose. The ConvertTemp function accepts three
arguments. The first argument indicates the temperature scale to convert from, the second
argument indicates the temperature scale to convert to, and the third argument is the numerical
value, variable, or expression to be converted. The temperature scale indicator can be F, C, K or
R, representing the Fahrenheit, Celsius, Kelvin, and Rankine scales, respectively. For example,
the following equation converts a temperature of 70°F to the Celsius temperature scale.

T_F=70 [F] "temperature in F"


T_C=converttemp(F,C,T_F) "temperature in C"

Note that there can be confusion in temperature units. In some cases, you may wish to convert a
temperature difference in Celsius to an equivalent temperature difference in Fahrenheit. In this
case you would not use the ConvertTemp function, but instead, use the Convert function, e.g.,
Convert(C,F). For clarity, EES provides temperature difference units , DELTAF, DELTAC,
DELTAR and DELTAK. For example, a variable representing a temperature difference could be
assigned units of DELTAC, which will be displayed as C in the Solutions Window. Use of the
temperature difference units is particularly important when using the Dual units option in the
Specific Format and Units dialog (Figure 1-63) as EES will automatically assume that a variable
having units of F, C, R, or K is a temperature rather than a temperature difference.

Adding Units
EES includes several hundred units and is therefore likely to include any unit you might run
across. However, it is possible to add to the list of units recognized by EES. For example,
braking distances are often expressed in car lengths where 1 car = 4 m. The unit ‘car’ is not
recognized by EES. The equation:

L=4 [car]*convert(car,m) "length, in units of car"

will result in the error message shown in

Figure 1-77: Error message.

We can add the unit car to the list of those that are recognized by EES by opening the file
Units.txt found in the root EES installation directory using any convenient editor (e.g.,
Notepad®), as shown in Figure 1-78.
64 Chapter 1: Introduction to EES

Figure 1-78: Units.txt file opened using Notepad® with the unit car added.

Instructions for adding units are found at the top of the Units.txt file. Unit conversions are
organized according to dimension. Locate the dimension of interest (in this case, Length). The
first entry in the unit list (in this case, m) is the basis used for conversion of all other units in that
dimension. Reading down the list, this should be clear (1 Angstrom = 1x10-10 m, 1 nm = 1x10-9
m, etc.). Add the appropriate entry at the bottom of the list, as shown in Figure 1-78, and save
the units.txt file. When EES is re-started it will load the new set of unit conversions and the
statement:

L=4 [car]*convert(car,m) "length, in units of car"

will not result in an error. The units of the variable L should be set to m in the Solution Window,
as shown in Figure 1-79. Note that you must de-select the Overwrite Units files selection when
updating EES (see Figure 1-2) or your modified units.txt file will be overwritten when a new
version of EES is installed.
Chapter 1: Introduction to EES 65

Figure 1-79: Solution Window.

Using String Variables for Units


The units of a variable can be assigned with a string variable. A string variable can be supplied
in place of the unit designation within the square brackets that follow numerical constant or
provided in the units column of the Variable Information dialog, as shown in Figure 1-80.

Figure 1-80: Variable Information dialog shown a string variable used for the units of a variable.

A string variable can be also used in the Convert function.

U$='kJ/kg'
h_SI=15 [U$]
h_Eng=h_SI*convert(U$, Btu/lb_m)

Note that providing alternate units in the Variable Information is an easier way to show results in
two sets of units. See Section 15.6 for an example using string variables to allow units to be in
either English or SI units in the Diagram window.

1.6 Printing
Once you have completed your EES solution, you will need to document the results in some
way. This section discusses how you can output information from the EES file.
66 Chapter 1: Introduction to EES

Printing a Hard Copy


The most direct method of output is simply to print a hard copy of your file to an installed
printer. To do this, select Print from the File menu to bring up the Print dialog shown in Figure
1-81(a). The printer and number of copies can be selected. The Print in color option causes EES
to attempt to print with the same color scheme that is used for the screen display. The Page
breaks option causes EES to print each window on a different page.

Note that, by default, not all of the windows in your EES file will be printed. You need to select
from among those shown along the left side of the dialog. While there is only one Equations
Window, there may be more than one Parametric, Lookup, Array and Integral Tables and Plots.
You will need to indicate both whether you want these items to be printed as well as which of
these items are to be printed. A black check mark indicates that all of the items will be printed,
an open box indicates that none will be printed, and a gray check mark indicates that a subset has
been selected. For example, if more than one Plot window is present in the EES code, then
clicking on the Plots box will bring up the Select Plots to print dialog shown in Figure 1-81(b).
Select Preview in the Print dialog to bring up an on-screen display of the printed output.

(a) (b)
Figure 1-81: (a) Print and (b) Select Plots to print dialogs.

The Print Setup selection from the File menu allows you to set up the details of the printing
process (e.g., orientation, paper size, etc.). By default, the font and style used for the printed
output is the same as those used for the on-screen display. However, the Printer tab on the
Preferences dialog allows you to adjust these values independently.

Copying Equations
It is also possible to copy equations from the Formatted Equations Window in EES so that they
can be pasted into various applications. We will use Eq. (1-10), repeated below, as an example.
Chapter 1: Introduction to EES 67

 1.25 64 3.44 
   
4  3.44 4 L 4 L

f   (1-20)
ReD  L 1
0.00021 
 
 L  
2


This equation is entered in the Equations Window as shown below.

f_bar=(4/Re_D)*(3.44/sqrt(L|plus)+(1.25/(4*L|plus)+64/4-3.44/sqrt(L|plus))/(1+0.00021/L|plus^2))

Open the Formatted Equations Window, shown in Figure 1-82. Highlight the equation and right
click to access the pop-up menu shown in Figure 1-83.

Figure 1-82: Formatted Equations Window.

Figure 1-83: Pop-up menu for the formatted equation.

Clicking on a comment in the Formatted Equations Window that contains a hidden or visible
hyperlink will automatically start your browser open this page. If you do not wish to have
hyperlinks active, select the Enable http links menu command from the Formatted Equations
pop-up menu so as to remove the check mark.

The three options at the bottom of the pop-up menu allow the equation to be copied and pasted in
a variety of formats. If the Copy as EES picture option is selected then the equation will be
placed on the clipboard as a picture (i.e., in windows metafile format), from which it can be
pasted into another application.

The next two options are only available in the Professional version of EES. The Copy as LaTeX
option translates the equation into LaTeX code that is placed on the clipboard. The Copy as
68 Chapter 1: Introduction to EES

MathType option translates the equation into MathType format that can subsequently be placed
in another application such as Microsoft Word® provided that the MathType® software is
installed.

LaTeX Report
EES can be used to create a high quality report that includes the Diagram, Equations, and
Solution Windows as well as any tables and plots. The report is created in the form of a TeX
document (.tex) that can be automatically processed by a LaTeX compiler to produce a device
independent (.dvi) output file that can be printed by various utilities. The PDFLaTeX accessory
available with the TeX compiler also produces a portable document interface (.pdf) file that is
compatible with Adobe Reader. The entire process can be made transparent to the user so that
the Latex Report feature effectively becomes a printer to produce .pdf files. The output quality
of the Latex Report feature is much higher than that obtained with the EES Print command.

Both the LaTeX software and Adobe Acrobat Reader (or any equivalent application) must be
installed on your computer in order to use this feature. These programs are available at no cost.
Download the distribution MiKTeX installation file (i.e., the latest version of the MiKTeX
software) from the web page https://miktex.org/download using the instructions provided when
you click the Help button in the Create LaTeX/PDF report dialog shown in Figure 1-84. Choose
the Basic MiKTeX Installer option for your operating system (32 or 64-bit). Note that EES must
eventually know the directory path in which the MiKTeX software is installed so you should
make a note of it. In order to configure EES to work with the MiKTeX package, start EES and
select Create LaTeX/PDF Report from the File menu in order to access the Create LaTeX/PDF
Report dialog shown in Figure 1-84. Click the Setup button and navigate to the pdfLaTeX
executable file (typically found in the miktex/bin subdirectory of the installation directory). If
you install MiKTeX in its default directory, EES will likely find it without your intervention.

In order to generate a report, access the dialog shown in Figure 1-84 by selecting the Create
LaTeX/PDF Report command in the file menu and enter the desired filename in the edit field at
the top of the window. By default, the filename will be the name of the EES file with a .tex
extension. The text entered in the Title field will be displayed at the top of the report. The
controls at the left side of the dialog allow you to select the items that will be included in the
report from among the various items in the EES file. If multiple items of the same type exist
(e.g., there are two plots in the EES file used to create Figure 1-84) then clicking on the value
within the square brackets will bring up a dialog that allows you to select a subset of the items.
The Equations Window selection provides some additional controls such as line numbering and
placing each equation and comments on separate lines. Very long equations may run off of the
right side of the report. It may be necessary to use the & character to break long equations into
segments in the Equations Window. The Solutions and Table group boxes each provide a control
that allows you to specify the number of columns per page to ensure that the text does not run off
the page of the report. The diagrams and plots that are to be included with the LaTeX document
are stored in separate jpeg files. The resolution of these files can be controlled using the JPG
quality control.
Chapter 1: Introduction to EES 69

Figure 1-84: Create LaTeX/PDF Report dialog.

At the bottom right of the dialog there are four checkboxes. If the Create PDF document
checkbox is selected then EES will attempt to start the PDFLaTeX application and compile the
.tex file in order to create a .pdf file. If the Display PDF document checkbox is selected then EES
will attempt to start Adobe Reader and display the .pdf file directly after it is created. If the
Delete TEX and JPG files checkbox is selected then the .tex file and .jpg files will be deleted,
leaving only the .pdf file. The Include Hyperlinks check box will only be enabled if you are using
a Professional verson and there are hidden hyperlinks within the Equations window. Clicking
this control will enable the hidden hyperlinks within the .PDF document.

Select Create to start the process of generating and compiling the report.
70 Chapter 1: Introduction to EES

1.7 Arrays
The variables that have been discussed in Sections 1.1 through 1.6 are all scalar variables; that is,
they can be assigned only one value. It will often be useful to use array variables which can be
assigned multiple values. Arrays are EES variables that have an array index enclosed in square
brackets at the end of the variable name. Data stored in arrays can be used to generate plots in
the same way that data stored in Parametric Tables can be used for this purpose, as discussed in
Section 1.4.

Assigning Array Variables


The variable T_scalar, assigned below, has one value.

T_scalar = 100 [K] "a scalar variable"

The value and units of the variable T_scalar can be examined in the Solution Window. The array
T_array[], assigned below, consists of three separate variables: T_array[1], T_array[2], and
T_array[3]. The value in subscripts is the index of the array; therefore, T_array[1] is the first
element of the array, and so on.

T_array[1]=100 [K] "the first element of the array T_array"


T_array[2]=200 [K] "the second element of the array T_array"
T_array[3]=300 [K] "the third element of the array T_array"

The values in the variable T_array[] will be stored in the Arrays Table Window, shown in Figure
1-85 and accessed by selecting Arrays from the Windows menu.

Figure 1-85: Arrays Table Window.

The array variables T_array[1], T_array[2], and T_array[3] behave just as ordinary EES variables.
They each have units, limits, guess values, etc. One purpose of using arrays is to organize
information; for example, each array variable may correspond to a thermodynamic state in a
system. Also, mathematical operations that are common to each element of an array can be
performed easily using the Duplicate command, discussed subsequently.

A string array variable must have the $ character just before the left bracket that holds the array
index. For example:

A$[1]='Hello'
A$[2]='World'
Chapter 1: Introduction to EES 71

Array Range Notation


A convenient shorthand method for referring to multiple array values uses the array range
notation. A continuous range of indices in an array can be referred to by the first index and last
index separated by two dots. For example, T_array[1..3] can be used in place of T_array[1],
T_array[2], T_array[3]. Array range notation can be used in a variety of contexts including
assignment statements. For example, the array T_array[] could be created using the statement:

T_array[1..3]=[100 [K], 200 [K], 300 [K]] "assignment using array notation"

Note that EES expects the correct number of values (three in the example above) to exist within
the square brackets on the right side of the equation above or it will post an error. If more than
three values were provided in the square brackets on the right side of the equation then the first
three would be used and EES would post a warning.

Two-Dimensional Arrays
If two indices are used for array assignments then the array will be two-dimensional (i.e., a
matrix rather than a vector). For example, the statement below:

T_array[1,1..3]=[100, 200, 300] "first row of array"


T_array[2,1..3]=[400, 500, 600] "second row of array"

results in the two-dimensional array shown in Figure 1-86.

Figure 1-86: Two-dimensional array shown in the Arrays Table Window.

The statement below assigns the value in the 2nd row (the first subscript) and 3rd column (the
second subscript) to the variable X. Examining the Solution Window shows that the scalar
variable X is equal to 600.

X=T_array[2,3] "value in 2nd row and 3rd column"


72 Chapter 1: Introduction to EES

The Array Editor


The Array Editor can be selected from the Edit menu in order to provide an easy way to enter or
modify EES arrays. Select the Array Editor command while you are in the Equations Window.

The Array Editor provides a convenient way to work with arrays. Ultimately the arrays accessed
by the Array Editor are listed in the Equations Window. In order to be recognized by the Array
Editor the array definition must begin with the comment {Array Name} and end with the comment
{Array Name end} where Name is the name of the array. For example, the statement below:

{Array a}
a[1,1..3]=[1,2,3]
a[2,1..3]=[4,5,6]
{Array a end}

would define the array a in a way that is recognized by the Array Editor. When the Array Editor
is opened, the dropdown menu at the top of the editor can be used to select from among any of
the arrays that have currently been defined in the Equations Window using this syntax. Note that
any array defined in the Array editor itself will use this syntax. Alternatively, a new array
variable can be created by selecting Enter array name from the Array drop down menu.

Modifications to existing arrays made in the Array Editor will show up in the Equations
Window. (Note that the Array Editor will not detect or be able to modify arrays that were not
created in the Array Editor.) This feature makes it easy to import data from other applications
such as Excel or MATLAB. For example, suppose you want to access a 5x5 array of data
generated in Excel, as shown in Figure 1-87.

Figure 1-87: An array of data in Excel.

Select Array Editor from the Edit menu. Name the array (D) and choose the right number of
rows and columns (5 and 5). Copy the data from Excel and select the Paste button ( ) to place
the data into the Arrays Editor, as shown in Figure 1-88.
Chapter 1: Introduction to EES 73

Figure 1-88: Arrays Editor.

Select OK and the array D[] will be created in the Equations Window.

{Array D}
D[1..5,1]=[0.835379821,0.536458607,0.607826536,0.50104002,0.250295049]
D[1..5,2]=[0.596997554,0.795630883,0.179900142,0.205868913,0.439109551]
D[1..5,3]=[0.142993304,0.210596416,0.161575547,0.576841329,0.4000961]
D[1..5,4]=[0.70532211,0.077083658,0.333396857,0.179171305,0.198072072]
D[1..5,5]=[0.081197923,0.285540063,0.419114502,0.147024152,0.863134795]
{Array D end}

Run the EES program and you will see the array D[] created in the Arrays Table, as shown in
Figure 1-89. Again, do not modify or delete the comments that EES places around the array
values, as these are used to identify the array to the Array editor.

Figure 1-89: Arrays Table.

The Duplicate Statement


The Duplicate statement provides a convenient method for carrying out similar operations on
multiple elements of an array. The protocol for a Duplicate statement is:

Duplicate index = start,stop


equation(s) to be duplicated
End
74 Chapter 1: Introduction to EES

The variable index is iterated from the value start to the value stop. The equation(s) contained
between the Duplicate and End statements are written for each iteration. For example, the EES
code:

duplicate i=1,4
T[i]=i
end

is equivalent to writing:

T[1]=1
T[2]=2
T[3]=3
T[4]=4

When using Duplicate statements it is particularly important to remember that EES uses equations
rather than assignments. That is, do not accidentally place equations within a Duplicate statement
unless you actually want these equations to be duplicated in the Equations Window. A common
mistake that new users of EES make is shown below:

duplicate i=1,4
T[i]=i
x=4
end

The above code is equivalent to writing:

T[1]=1
x=4
T[2]=2
x=4
T[3]=3
x=4
T[4]=4
x=4

which leads to 8 equations in 5 unknowns. Solving the EES code will lead to an error message.

Nested Duplicate statements can be used to generate two-dimensional arrays. For example, the
code below:

duplicate i=1,3
duplicate j=1,4
D[i,j]=i+j
end
end

leads to the two-dimensional array shown in Figure 1-90.


Chapter 1: Introduction to EES 75

Figure 1-90: Two dimensional array generated using a nested Duplicate statement.

It is possible to define array variables with more than two indices but this practice is not
recommended.

Arrays in the Variable Information Dialog


The units of all elements in an array are often the same because a typical array represents
different values of the same physical quantity. For example, the array T[]:
T[1..3]=[100,200,300]

might represent a set of temperatures. Select Variable Info from the Options menu to access the
Variable Information Window, shown in Figure 1-91(a). By default, each element of the array is
shown and the guess values, limits, and units can be set differently for each element. This
arrangement is inconvenient if all elements share a common set of characteristics. De-select the
Show array variables check box in the upper left corner in order to collapse the array, as shown
in Figure 1-91(b). Any characteristic set for the row T[] will be applied to each element of the
array.

(a)

(b)
Figure 1-91: Variable Information Window (a) with each element of T shown and (b) with the array T
collapsed.
76 Chapter 1: Introduction to EES

It is possible to assign different values of the guess values or limits to each element in an array
using a different array that is setup just for this purpose. This capability is discussed in Section
5.4.

Using the Variable Information Dialog with Large Arrays


It can be cumbersome to locate the row in the Variable Information dialog that corresponds to a
particular array element when the EES program contains many large arrays. For example,
suppose you have a program that uses arrays x, y, and z, each having a dimension of 1000. You
now want to change the guess value for z[1]. To do so in the Variable Information dialog, you
need to scroll to the first element in the z array, which is row 2001. A simple way to do this is to
collapse the arrays by unchecking Show array variables check box so that the arrays are
represented as x[], y[], and z[]. Select z[] by clicking on it. Now check the Show array
variables check box to expand the arrays.\. The list of variables show the first element in the z
array.

Purge Unused Variables


EES saves every variable that you introduce as you develop your program. For example, if you
start your problem with an array X[] that contains 500 entries and then later change its name to
Y[], EES will retain in memory both X[] and Y[] for a total of 1000 variables. This is done so that
you don't have to re-enter the characteristics (e.g., units and limits) of the variable X[] should you
want to temporarily remove it. Similarly, if at some point your array X[] is defined with 2000
entries and later you reduce its size to 500 entries then EES will retain in memory 2000
variables.

It is often the case that you will want to redefine the size of the arrays that you use in an EES
program. For example, arrays are particularly useful in order to solve the system of algebraic
equations that result from numerical models. These equations correspond to a set of equations
written for each node or control volume defined within a computational domain. One of the
most important things that you should do with a numerical model is to verify that the number of
nodes is sufficiently large that the numerical model has converged. This check is typically done
by increasing the number of nodes and observing how the solution changes. The final number of
nodes that is used is always a compromise between computational time and accuracy.

Based on this discussion, it is clear that you can easily introduce many variables using arrays that
you do not ultimately wish to use. In order to clear these variables from memory you must use
the Purge Unused Variable command from the Options menu, at which point EES will check if
there are unused variables in memory and ask whether you want to purge or keep them. Solving
the EES code below generates a 50x50 two-dimensional array D[]. The EES program includes
2502 variables, all of the entries in the array D[] as well as the variables Nx and Ny.

$TabStops 0.25 0.5 in


Nx=50
Ny=50
duplicate i=1,Nx
duplicate j=1,Ny
Chapter 1: Introduction to EES 77

D[i,j]=i*j
end
end

Now reduce the values of the variables Nx and Ny, as shown below, in order to generate a 10x10
array and reduce the number of active variables to 102.

$TabStops 0.25 0.5 in


Nx=10
Ny=10
duplicate i=1,Nx
duplicate j=1,Ny
D[i,j]=i*j
end
end

Because EES retained the original 2502 variables in memory there are currently 2400 unused
variables. In order to purge these variables and reduce the size of the EES file select Purge
Unused Variables from the Options menu. You will be asked to confirm that you want to purge
the unused variables with the dialog shown in Figure 1-92.

Figure 1-92: Purge unused variables.

It is wise to save the file with a different name before you purge variables.
78 Chapter 1: Introduction to EES

1.8 Lookup Tables and Lookup Files


Lookup Tables (displayed in an EES table) and Files (stored, but not visible) provide a
convenient method of saving and accessing tabular data. The data available in Lookup Tables
and Lookup Files are useful for interpolation and curve fitting, as discussed in Chapter 2

Creating a Lookup Table


To create a Lookup Table, select New Lookup Table from the Tables menu. The name and the
number of rows and columns in are entered in the resulting dialog, as shown in Figure 1-93.

Figure 1-93: New Lookup Table dialog.

Select OK in order to generate the blank Lookup Table shown in Figure 1-94(a).

(a) (b) (c)


st nd
Figure 1-94: Lookup Table (a) blank, (b) with 1 column filled in, and (c) with 2 column filled in.

Entering Data
Data can be typed directly into the cells of the table or pasted from the clipboard. Alternatively,
the values in a selected column can be entered, cleared, or changed by either selecting the
triangle icon ( ) or right clicking on the column header and selecting Alter Values; either option
brings up the Alter Values dialog. Select Enter Values and then indicate the pattern that should
be used. For example, Figure 1-95(a) shows the Alter Values dialog set up in order to enter
values ranging from 0 to 10 in equal increments, leading to Figure 1-94(b).

The column widths can be adjusted manually by dragging the divider between cells in the header
(top) row. Also, note the double arrow in the upper left cell above the Paste Special button in the
Professional version. Clicking this button will adjust the width of each column in the Lookup
Chapter 1: Introduction to EES 79

Table to fit the data. Clicking the button again will return the column widths to their original
values.

(a) (b)
Figure 1-95: Alter Values dialog shown (a) with Enter Values selected and (b) with Enter Equation selected.

In the Professional version, a value greater than the current number of rows can be entered in the
Last Row field (upper left in Figure 1-94). In this case, EES will, after confirmation, increase
the number of rows in the Lookup table to this value.

When text data are available on the clipboard, the Paste Special (green) button will be visible in
the upper left cell of the Lookup table as shown in Figure 1-94. Clicking this button will bring
up the Paste Special dialog (Figure 1-96). This dialog will allow data that use tabs, commas,
spaces, or semicolons to separate values in each column. In addition, this dialog makes it
possible to paste the column names and/or units into the Lookup table starting at a specified row
and column.

Figure 1-96: Paste Special dialog.


80 Chapter 1: Introduction to EES

Using Equations in a Lookup Table


Values can also be entered using equations by selecting Enter Equations in the Alter Values
dialog, as shown in Figure 1-95(b). The equation can refer to values in the EES workspace or
values in other columns of the Lookup Table. For example, Figure 1-95(b) illustrates the Alter
Values dialog setup so that the values in column 2 are calculated as the product of the sine and
cosine of the values in column 1. The indicator #X refers to values in column X where X is an
integer or the name of an existing column in the Lookup tablew. Click the Check Units check
box (below the equation edit box) to optionally check the equation for unit consistency. Clicking
OK results in the Lookup Table shown in Figure 1-94(c).

Using the Enter Equation option, values can be entered into the selected column of the table as a
function of values in other columns, previously-defined variables in the EES worksheet and EES
functions. Using this capability results in the Lookup table operating much like as spreadsheet
program. The #X sequence is used to refer to values in another column. For example the
following entry would set the values in column 1 of the Lookup table to 5* the values in column
2. Note that, instead of entering #2, you could alternative enter #ColName, where ColName is
the name of the column. The changes are applied only to the rows indicated in the edit boxes at
the upper left of the dialog.

Any of the EES functions can be used in the equation. For example, the following entry converts
temperatures in C (in column 2 of the table) to K.

In some cases, it is necessary to refer to a particular row of a column in the Lookup table. This
capability is available by including the row number in brackets. For example, the following
equation sets all of the values in column 1 to the value in row 3 of column 2.

Finally, is sometimes necessary to refer a row above or below the current row for which a value
is being entered. #R refers to the current row. #R can be used in a subscript. Entering #2[#R] is
exactly equivalent to entering #2. However, you can offset the row values by entering the offset
to #R. For example, the following equation copies the values in column 2 to column 1, but it
offsets the row so that the value in column 1 row 2 is equal to the value in column 2 row 1, and
so on for the entire row range.
Chapter 1: Introduction to EES 81

Note that EES will not provide an error if the row is less than zero or greater than the maximum
number of rows.

The Professional version provides the option to automatically update the values in a column that
have been set with an equation. Checking automatic update will result in the values assigned
with an equation being updated whenever the values it depends upon are changed. The values in
a Lookup table can be changed by the Lookup command in an EES function or EES Macro, by
the $CopytoLookup directive, or by entering or pasting values into the table.

Saving and Loading Lookup Files


Lookup Tables created in an EES file are saved with other information when the EES file is
saved. The Lookup Tables are available when the EES file is reopened. There is no need to
separately save a Lookup Table unless you wish to: 1) make the data available to another EES
program; 2) make the data available to other applications, e.g., EXCEL, or 3) save the data in a
Lookup file on disk so that it can be used as with Lookup commands without having the data be
visible in the EES Lookup Table.

To save an existing Lookup Table, right click on the tab for the Lookup Table to bring up the
Information Dialog for the Lookup Table, as shown in Figure 1-97.

Figure 1-97: Right-click on Lookup Table tab to bring up this dialog

The dialog allows you to edit the name, add some descriptive text, duplicate the Lookup Table
and alter its position with regard to other Lookup Tables in the EES file. The Save button allows
you to save the Lookup Table in a variety of formats. The data alone can be saved in an ASCII
text (.txt) or comma separated value (.csv) file that can be read by most other applications. The
data with the headers can also be saved in a text file. The table can also be saved in the EES-
specific Lookup File or Lookup Table formats. The Lookup Table (.lkt/.lkt64) format is a binary
82 Chapter 1: Introduction to EES

format that can subsequently be opened in other EES files or read directly by EES when using
Lookup Table/File functions. This format is typically easiest to use and corresponds to a Lookup
Table that is saved by and can subsequently be opened by the EES software. Lookup Files saved
in the .lkt/.lkt64 format are scecure because they are written in a binary format that cannot be
read by any application other than EES. All of the information associated with the file including
column names, units and column format, is saved in the .lkt/.lkt64 file. See Lookup File Formats
in the online help for details about these data file types.

Deleting Lookup Tables from the Lookup Table Window


Lookup tables are saved with an EES file. They can be saved independently as explained in the
previous section. This is useful if the data in the Lookup table are to be used in another program
or you wish to not show the data. An existing Lookup table can be deleted in two ways. One
way is to right-click on the window tab to bring up the dialog window shown in Figure 1-97:
Right-click on Lookup Table tab to bring up this dialog. Click the Delete button, A second way
to delete one or more Lookup tables is the Delete Lookup Tables command in the Tables menu.
Selecting this command will bring up the dialog window shown in (Figure 1-98) which lists all
Lookup tables. Click the tables that are to be deleted, which will place a check mark before the
table name. Then click Delete.

Figure 1-98: The Delete Lookup Tables dialog

Note that deleting the Lookup table means that the data that it contains will not be saved with the
EES file the next time the EES file is saved. However, the Delete command does not delete a
Lookup table that has been saved separately in Lookup File that has an .lkt, .txt, .csv, or other file
name extension.

Lookup Table/File Commands


A complete list of all of the built-in functions that can access dataata in a Lookup Table or
Lookup File is provided in Appendix A, Table A-9. Data in a Lookup Table/File can be
interpolated using 1-D or 2-D interpolation, as discussed in Chapter 2. Data in a Lookup
Table/File can be retrieved using the Lookup function (for numerical values) or the Lookup$
function (for strings). The calling protocol for the Lookup function is:

X = Lookup('TableName',Row,Column)
Chapter 1: Introduction to EES 83

where 'TableName' is a string containing either the name of the table of interest (i.e., the name
shown in the tab in the Lookup Window) or the name of the Lookup File stored on disk
(including the directory information and file name extension). TableName may be provided with
a string variable. Note that all of the built-in functions listed in Appendix A, Table A-9 can
access a Lookup File stored on disk (rather than a Look Table displayed in EES) by providing
the name of the file rather than the name in the Lookup Table tab. Row is the number of the row
in the table and Column is either the number or name of the column. For example, the command:

X=Lookup('My Lookup Table', 3, 2)

will result in the variable X being assigned 0.4947 if the Lookup Table shown in Figure 1-94(c)
is available in the EES file. Non-integer values of the column or row will result in linear
interpolation; however, the Interpolation functions discussed in Chapter 2 are more appropriate
for this type of operation and provide the option of higher order interpolation.

Data can be written to a Lookup Table using the Lookup command in a Function or Procedure or
with the $CopytoLookup directive. Functions and Procedures are described in Chapter 3.

Lookup File Formats


A Lookup file is a two-dimensional table of data that has been stored in a disk file. A name and
display format for each column of data may also be stored, depending on the file format.
Lookup files can be accessed by the Differentiate, Interpolate, Lookup, LookupCol, and
LookupRow, SumLookup, AvgLookup, MinLookup, MaxLookup, and StdDev Lookup
commands in the same manner as for Lookup tables. The only difference is that the name of the
file (with the file name extension) is provided to the command instead of the name of the table.
EES recognizes both binary and ASCII forms for Lookup files. Binary files are identified with a
.LKT filename extension. ASCII Lookup files can have a .TXT, .CSV, or .DAT filename
extension. Each file format has advantages and disadvantages. The binary form is read in more
quickly and requires a smaller file size. The ASCII form is easier to edit and it can be read and
written by spreadsheet or other applications. Details for each file type follow:

Binary Lookup files (.LKT and .LKT64)


Binary Lookup files store all of the information that appears in a Lookup Table window in a
binary file on disk, including the data, and the column name, units, and display format for each
file type. A binary Lookup file is created using the Save Lookup Table command or with the
$SaveTable directive. Once created, the Lookup file can be opened into the Lookup Table
window using the Open Lookup Table menu command, the $OPENLOOK directive, or a Link
button (type 6) on the Diagram window. The .LKT file format is used by 32-bit versions of EES.
However, it is not necessary to open the file in order to access the data in the file. The file is
opened internally (without needing the Lookup table) when commands such as Interpolate,
Lookup etc. are provided with the name of the file. The .LKT64 file format can only be read or
written by the 64-bit version of EES.

ASCII Lookup files (.TXT)


There are several variations for the .TXT Lookup file format. In the basic form, the first line of
the file contains the number of rows and columns in the table. Each following line provides the
84 Chapter 1: Introduction to EES

data for one row with the value for each column separated by one or more spaces or a tab
character. The basic form does not provide a means of specifying the names, units, or display
format for the data. EES assigns the names "COLUMN1', 'COLUMN2', etc. and these column
names should be used when the file is used with the Interpolate or Differentiate commands.
Automatic formatting is used to display the data if the file is read into the Lookup Table with the
Open Lookup Table command. The following example shows the .TXT data needed for a
Lookup file with five rows and three columns, with no column header information.

5 3
1 11 111
2 22 222
3 33 333
4 44 444
5 55 555

If the number of rows is a negative number, EES will determine the number of rows of data in
the file when the file is read.

If the number of columns is a negative number, EES will expect to find the format specification.
A format specification consists of one or two characters. The first character is the type of format
and the second character indicates the number of digits provided for this format. The number of
digits is usually an integer between 0 and 9 but the letter ‘M’ can be supplied to indicate the
maximum possible number of digits. Valid format specifications are:

A auto format. A followed by a number, e.g., A3, is accepted but the number is ignored.
F# fixed decimal format with # digits after the decimal point, e.g., F3.
E# exponential format with # digits after the decimal point or #+1 significant figures, e.g., E2
N# N significant figure format with # being the number of significant figures, e.g., N4
G# engineering format with # significant figures, e.g., G4
T# Time format; if # is 0, the default format is used; if # is 1, the format is
hours:minutes:seconds; if # is 2, the format is hours:minutes
D# Date format; # must be between 0 and 9 representing different date formats. 0 is the
default format
S string format. S followed by a number, e.g., S0, is accepted but the number is ignored.

The format specification is followed by one or more spaces and then the column heading and
units for each column. If a column contains string data, then the format specification must be S
(or S#) and the string data must be contained in single quotes. Units are optional but if supplied,
they must be enclosed in square brackets with a least one space separating them from the column
name. The following lines contain the .TXT data for each row, separated by one or more spaces
or a tab. The example below would create a table with 2 rows and 3 columns. The columns
would be formatted with E4, F1, and S format specifications and the column names will be
ColA, ColB, and Name.

2 -3
E4 ColA [Btu]
F0 ColB
Chapter 1: Introduction to EES 85

S Name
1.23E-12 2.2 'A'
2.34E-11 4.8 'B'

The Save Table command in the Tables menu and the $SaveTable directive provides a way to
save a Lookup table as a .txt file including the column header information.

ASCII Lookup files (.CSV)


The .CSV file provides only data without any information concerning the column names or data
format. The number of values in the first row of the file determines the number of columns in
the table. The number of rows in the table is equal to the number of rows of data. Values on
each row are separated with the list separator character. Each row ends with a linefeed - carriage
return.

ASCII Lookup files (.DAT)


Like the .CSV file, files with this filename extension provide only data without any information
concerning the column names or data format. The number of values in the first row of the file
determines the number of columns in the table. The number of rows in the table is equal to the
number of rows of data. Values on each row are separated with a tab character. Each row ends
with a linefeed - carriage return.

Files having filename extensions other than .TXT, .LKT, .LKT64, .CSV, or .DAT can be read
provided that they are ASCII files with numerical values separated by a space or comma.

Lookup files with ASCII data may be read in with specifications provided by a FORMAT (.fmt)
file. See the online help for details relating to this file.

1.9 Other Features


There are a few additional basic features of EES that are worth discussing before closing out our
introduction to the program.

Built-In Constants
Constants in EES are denoted by a # sign after the name; constants are like variables in EES
except that their values cannot be changed in the Equations Window. A large number of
common physical constants are pre-assigned in EES. These entries can be viewed by selecting
Constants from the Options menu in order to access the Constants dialog, shown in Figure 1-99.
86 Chapter 1: Introduction to EES

Figure 1-99: Constants dialog.

Many physical constants of interest are available; for example, pi# is the value of  (actually, pi
also refers to  and is the only built-in constant in EES that does not require the use of #). R# is
the universal gas constant, k# is Boltzmann’s constant, etc. These constants are provided in the
unit system that has been specified by the user, as discussed in Section 1.5. The order of the
constants appearing in this dialog can be changed by clicking on the column header. For
example, clicking on Name at the top of column 1 will rearrange the order of the table so that the
entries are ordered alphabetically in terms of their names. Clicking a second time on Name will
reverse the order.

Adding Constants
It is possible to add constants by selecting Add from the Constants dialog in Figure 1-100 in
order to access the Add New Constant dialog shown in Figure 1-100.

Figure 1-100: Add New Constant dialog.

The Add New Constant dialog prompts the user for the name, description, and value of the
constant in both SI and English units. For example, suppose we want to enter the Bohr radius,
a0, to our EES program. The value of the Bohr radius is 5.291772x10-11 m (or 1.736146x10-10 ft)
according to Mohr et al. (2011). The Add New Constant dialog should be filled out as shown in
Figure 1-100. If you select OK and access the Constant dialog by selecting Constants from the
Options menu then you will see that the constant a_0# has been added to the bottom of the
dialog, as shown in Figure 1-99. The new constants list can be saved by selecting the Store
Chapter 1: Introduction to EES 87

button in the Constants dialog so that it is available each time EES is opened. Note that you will
need to de-select the Overwrite Constants.txt file in the installation process, shown in Figure 1-2,
in order to keep your added constants when you update or reinstall the EES program.
Alternatively, make a copy of the Constants.txt file to ensure that it is not overwritten when you
install a new version of EES.

The user can also specify the value of constants in an EES program using the $Constant directive.
The calling protocol for the $Constant directive is:

$Constant Name# = ValueSI [UnitsSI] ValueEng [UnitsEng]

where Name# is the name of the constant, ValueSI and ValueEng are the values of the constant in
the SI and English units specified by [UnitsSI] and [UnitsEng], respectively. For example, the Bohr
radius can be entered in EES according to:

$Constant a_0#=5.291772e-11 [m] 1.736146 [ft]

Finally, it is possible to edit the Constants.txt file directly to add a constant that is loaded each
time EES is opened. See Section 14.3 for more detail relating the $Constant directive.

The Calculator Window


The Calculator Window allows you to quickly carry out simple calculations without interfering
with the equations that are entered in the Equations Window. This capability is often very useful
when you are trying to debug an EES code or understand a solution. The Calculator Window
allows you to enter and solve single-line expressions that involve any of the variables that have
previously been defined and evaluated in the Equations Window. Any of the built-in functions
in EES can be accessed from the Calculator Window. For example, enter and solve the
following equations:

a=b+2
b^2=4+c
c=a-b

which should lead to the Solution Window shown in Figure 1-101.

Figure 1-101: Solution Window.


88 Chapter 1: Introduction to EES

Open the Calculator Window by selecting Calculator from the Windows menu (or selecting the
button), as shown in Figure 1-102.

Figure 1-102: Calculator Window.

The result of any command preceded by a question mark will be displayed in the Calculator
Window. For example, the command:

?a+b

will lead to 6.899, as shown in Figure 1-102. New variables can also be defined in the
Calculator Window (provided that they don't already exist in the Equations Window). For
example, we can define the variable d in the Calculator Window:

d=a+b

and then use the variable d in a new expression, also shown in Figure 1-102. Use % to refer the
last calculated variable.

Preferences and Syntax Highlighting


Select Preferences from the Options menu in order to access the Preferences dialog shown in
Figure 1-103. The Preferences dialog allows the user to specify a large number of characteristics
of the EES program that are categorized according to the tabs at the bottom of the dialog. For
example, in the Options tab shown in Figure 1-103 you can specify how often the file is auto-
saved, whether units are checked automatically, whether or not to maintain a list of recently
opened files, and a number of other options. Some of these options can be set by Directives as
shown in Appendix C. For example, the option to display a Sum row in the Parametric table can
be enabled with $SUMROW On. The option to automatically check units can be enabled with
$CheckUnits AutoOn. Each tab contains choices of this nature that will be discussed throughout
this book.
Chapter 1: Introduction to EES 89

Figure 1-103: Preferences dialog showing general options.

The Display preferences are shown in Figure 1-104. The fields in this window control some of
the basic display options. These options are applied independently of the setting of the Syntax
Highlighting control in the status bar of the Equations window. One of the most useful options is
the size of the font. The default size is 10, but the drop-down menu allows sizes to be selected
from 8 to 24. Large font sizes are useful when projecting EES in a classroom or presentation.
The screen can be dimmed with gray tones using the slider control at the bottom of this dialog.

Figure 1-104: The Display options in the Preferences Dialog.

The options in the Syntax tab are shown in Figure 1-106. The Tab Stops option can place up to
25 tabs at the specified locations, which are very useful for organizing the content. This option
can be also specified with the $TabStops directive as described in Appendix C. All of the other
90 Chapter 1: Introduction to EES

options affect the appearance of the content in the Equations window when the Syntax
Highlighting control in the status bar at the bottom of the Equations window

Figure 1-105) is selected. Clicking the Equations window button in the button bar below the
main menu bar when the Equations window is visible will also toggle the syntax highlighting
display on/off.

Figure 1-105: Equation Window status bar.

Figure 1-106: The Syntax Highlighting options in the Preferences Dialog.

Syntax highlighting affects the display of keywords and both built-in and user-supplied
Functions, Procedures, Modules and Subprograms. The display options allow the both the case
and style of Function names and EES Keywords to be independently controlled. The font color
and style of constants and strings can be specified. Syntax highlighting can enhance the display
and make the equations easier to read as shown in Figure 1-107, where a section of the Equations
window is shown both without and with syntax highlighting using the default options.

Figure 1-107: Equation Window without and with syntax highlighting.

Syntax highlighting must be on in order to have hyperlinks active. Note: Syntax highlighting
can increase the time required for EES to refresh the display. If you have a large EES program
and the display is slow, you may want to turn off syntax highlighting.

Clicking the Reset button will reset all preferences to their original (as-shipped) settings.
Chapter 1: Introduction to EES 91

Pressing OK will set the preferences you selected to be in effect for only the current session.
However, selecting the Store button will cause the preferences to be saved in an EES Preferences
(.prf) file. If you save the file as EES.prf in the EES working directory (which is the default
selection that is used when you select Store), then these preferences will automatically be loaded
whenever EES is started. Alternatively, you can save a .prf file that you want to apply only to
the current file in an alternative directory and subsequently load it using the Load button in
Figure 1-103.

Even more convenient is to load the preferences automatically using the $INCLUDE directive.
The $INCLUDE directive is discussed more completely in Section 14.5. Briefly, it provides a
method to automatically load various types of external files in an EES program. One type of file
that can automatically be loaded is the Preferences file.

For example, select Preferences from the Options dialog and then select the Display tab. Adjust
the font, size, etc. as you see fit and select Store. Save the .prf file in a directory of your
choosing (e.g., C:\temp\My Preferences.prf). Place an appropriate $INCLUDE directive at the top
of your EES file.

$INCLUDE C:\temp\My Preferences.prf

If you close and re-open the file you should find that the selections that you made in the
Preferences dialog and saved in the file My Preferences.prf are automatically loaded and used in
your EES file.

References
Mohr, P.J., B.N. Taylor, and D.B. Newell, "The 2010 CODATA Recommended Values of the
Fundamental Physical Constants (Web Version 6.0)," NIST, Gaithersburg, MD, 20899,
(2011).

Nellis, G.F. and S.A. Klein, Heat Transfer, Cambridge University Press, New York, (2009).

Shah, R.K. and A.L. London, Laminar Flow Forced Convection in Ducts, Academic Press, New
York, (1978).

You might also like