《ees-lecture-4》由会员分享,可在线阅读,更多相关《ees-lecture-4(34页珍藏版)》请在金锄头文库上搜索。
1、Computer Aided Engineering,Introduction to EES (Engineering Equation Solver) Lecture 4 Lookup tables, Plots & Graphs,Contents,EES introduction tutorial (4 Lecures) Solving nonlinear & implicit equations (Lect 1) Formatting of equations (Lect 1) The unit system (Lect 2) Built-in functions (Lect 2) Th
2、e Options menu (Lect 3) Parametric studies & plot basics (Lect 3) Lookup tables (Lect 4) Plots (Lect 4),0:35,Lookup Tables,Lookup Tables and Lookup Files (residing on the disk) provide a means of using tabular information in the solution of equations A good example is the variation of a property suc
3、h as air density with temperature Conveniently (again!), EES uses a spreadsheet approach. (EES Lecture 4.1 - SimpleLookupTable.EES):,0:08,Lookup Tables,This is how the air density changes with temperature at ambient pressure. One could, of course, fit a mathematical function through that, however it
4、 is much simpler and more flexible to put the data in a lookup table or lookup file:,0:10,Lookup Tables,Lookup data can be accessed using two functions: Using the Lookup function, one specifies a specific row and column and retrieve a value for the other column for the same specified row The Interpo
5、late function is much more useful. In essence it works like the Lookup function, except that the retrieved value could fall between table rows. EES would then interpolate for this value, using several interpolation schemes There are 2 ways to specify Lookup table data: Create and use a lookup table
6、in EES and add the required data to it (shown on the previous slide). It can be directly pasted from Excel with headings and units for example (using Paste Special) Add the data to a text file and simply tell EES about the file. The file has the following format:,0:15,Lookup Tables,0:15,Number of ro
7、ws Number of columns Minus sign indicates that heading data is present Number format (Auto 3-digit) Column title Column unit First column (T) Second column (rho_air),One could also omit the file headings and just specify the column data, but that is far less flexible and user-friendly!,Heading data,
8、Lookup Table Creation,A lookup table is created from the Table menu: Data and headings can be manually entered or pasted from a text file or Excel:,0:15,Lookup Table Usage,“Format: TableName, RowNo (or RowName), ColNo (or ColName)“ T_1 = Lookup(Lookup 1, 4, 1) “The table name is a string“ rho_1 = Lo
9、okup(Lookup 1, 4, 2),0:25,Lookup Table Usage,“Instead of a column number, we could specify the column by name via a string.“ T_2 = Lookup(Lookup 1, 5, T) “T is a string!“ rho_2 = Lookup(Lookup 1, 5, rho_air) “This way, row is a variable, which is much more flexible“ row = 6 T_3 = Lookup(Lookup 1, ro
10、w, T) rho_3 = Lookup(Lookup 1, row, rho_air),0:25,Lookup Table Usage,“More useful interpolate commands“ “Format: TableName, Col1Name, Col2Name, ColValue“ “Note the single quotes!“ rho_4a = Interpolate(Lookup 1, T, rho_air, T=65) “As long as strings have no spaces, we can omit the quotes“ rho_4b = In
11、terpolate(Lookup1, T, rho_air, T=65) “We could also provide the value for the density column and retrieve the temperature“ T_4 = Interpolate(Lookup1, T, rho_air, rho_air=1.2),0:25,Lookup Table Usage,“It is mostly a good idea to specify the properties such as temperature as variables“ T_5 = 65 C rho_
12、5a = Interpolate(Lookup1, T, rho_air, T=T_5) “The lookup table can also reside in a disk file. Better to use string format for file name as file names often have spaces“ rho_5b = Interpolate(Lookup 1.txt, T, rho_air, T=T_5),0:25,Lookup Table Notes,A table can be saved to disk (or opened) from the Ta
13、ble menu as shown. The saved file format can be text (txt), binary (lkt) or comma seperated variable (csv). EESs built-in libraries are binary and are stored in the Userlib directory as shown.,0:25,Lookup Table Notes,Note: There are 5 versions of the Interpolate function: INTERPOLATE uses cubic inte
14、rpolation INTERPOLATE1 uses linear interpolation INTERPOLATE2 uses quadratic interpolation INTERPOLATE2D does a 2-D interpolation, stored in a table. INTERPOLATE2M does a 2-D interpolation, stored in a matrix,0:25,Lookup Table Notes,As shown before, one can omit the string quotes in the Interpolate
15、function, and in many (most) other built-in EES functions, provided there are no spaces in the strings. However, this does not work for the Lookup function. In the Lookup function, the table or file name can omit the quotes, but the column names cannot! This is so since columns can also be numbered.
16、,0:25,Advanced Lookup Table,A more extensive example is the International Standard Atmosphere (ISA) which gives the properties of the atmosphere at different altitudes In the example, four properties are listed against each other. One can interrogate any two columns at a time. Please refer to “ISA Atmosphere.xls” (EES Lecture 4.2 ISA LookupTable.EES),0:08,Advanced Lookup Table,This is what the International Standard Atmosphere t