CombiTable2DvTable look-up in two dimensions (matrix/file) with vector inputs and vector output of size n |
This information is part of the Modelica Standard Library maintained by the Modelica Association.
Bivariate constant, bilinear or bivariate Akima interpolation of a two-dimensional table. The grid points and function values are stored in a matrix "table[i,j]", where:
Example:
| | | | | 1.0 | 2.0 | 3.0 | // u2 ----*-------*-------*-------* 1.0 | 1.0 | 3.0 | 5.0 | ----*-------*-------*-------* 2.0 | 2.0 | 4.0 | 6.0 | ----*-------*-------*-------* // u1 is defined as table = [0.0, 1.0, 2.0, 3.0; 1.0, 1.0, 3.0, 5.0; 2.0, 2.0, 4.0, 6.0] If, e.g., the input u1 is {1.0}, input u2 is {1.0} and smoothness is LinearSegments, the output y is {1.0}, e.g., the input u1 is {2.0}, input u2 is {1.5} and smoothness is LinearSegments, the output y is {3.0}.
smoothness = 1: Bilinear interpolation = 2: Bivariate Akima interpolation: Smooth interpolation by bicubic Hermite splines such that der(y) is continuous, also if extrapolated. = 3: Constant segments = 4: Fritsch-Butland interpolation: Not supported = 5: Steffen interpolation: Not supported = 6: Modified Akima interpolation: Not supported
extrapolation = 1: Hold the first or last values of the table, if outside of the table scope. = 2: Extrapolate by using the derivative at the first/last table points if outside of the table scope. (If smoothness is LinearSegments or ConstantSegments this means to extrapolate linearly through the first/last two table points.). = 3: Periodically repeat the table data (periodical function). = 4: No extrapolation, i.e. extrapolation triggers an error
The table matrix can be defined in the following ways:
tableName is "NoName" or has only blanks, fileName is "NoName" or has only blanks.
or Scilab by commandsave tables.mat tab1 tab2 tab3
when the three tables tab1, tab2, tab3 should be used from the model.savematfile tables.mat tab1 tab2 tab3
When the constant "NO_FILE_SYSTEM" is defined, all file I/O related parts of the source code are removed by the C-preprocessor, such that no access to files takes place.
If tables are read from a text file, the file needs to have the following structure ("-----" is not part of the file content):
----------------------------------------------------- #1 double table2D_1(3,4) # comment line 0.0 1.0 2.0 3.0 # u[2] grid points 1.0 1.0 3.0 5.0 2.0 2.0 4.0 6.0 double table2D_2(4,4) # comment line 0.0 1.0 2.0 3.0 # u[2] grid points 1.0 1.0 3.0 5.0 2.0 2.0 4.0 6.0 3.0 3.0 5.0 7.0 -----------------------------------------------------
Note, that the first two characters in the file need to be "#1" (a line comment defining the version number of the file format). Afterwards, the corresponding matrix has to be declared with type (= "double" or "float"), name and actual dimensions. Finally, in successive rows of the file, the elements of the matrix have to be given. The elements have to be provided as a sequence of numbers in row-wise order (therefore a matrix row can span several lines in the file and need not start at the beginning of a line). Numbers have to be given according to C syntax (such as 2.3, -2, +2.e4). Number separators are spaces, tab (\t), comma (,), or semicolon (;). Several matrices may be defined one after another. Line comments start with the hash symbol (#) and can appear everywhere. Text files should either be ASCII or UTF-8 encoded, where UTF-8 encoded strings are only allowed in line comments and an optional UTF-8 BOM at the start of the text file is ignored. Other characters, like trailing non comments, are not allowed in the file. The matrix elements are interpreted in exactly the same way as if the matrix is given as a parameter. For example, the first column "table2D_1[2:,1]" contains the u[1] grid points, and the first row "table2D_1[1,2:]" contains the u[2] grid points.
MATLAB is a registered trademark of The MathWorks, Inc.
n |
Value: 1 Type: Integer Description: Dimension of input and output vectors. |
---|---|
tableOnFile |
Value: false Type: Boolean Description: = true, if table is defined on file or in function usertab |
table |
Value: fill(0.0, 0, 2) Type: Real[:,:] Description: Table matrix (grid u1 = first column, grid u2 = first row; e.g., table=[0, 0; 0, 1]) |
tableName |
Value: "NoName" Type: String Description: Table name on file or in function usertab (see docu) |
fileName |
Value: "NoName" Type: String Description: File where matrix is stored |
verboseRead |
Value: true Type: Boolean Description: = true, if info message that file is loading is to be printed |
smoothness |
Value: Modelica.Blocks.Types.Smoothness.LinearSegments Type: Smoothness Description: Smoothness of table interpolation |
extrapolation |
Value: Modelica.Blocks.Types.Extrapolation.LastTwoPoints Type: Extrapolation Description: Extrapolation of data outside the definition range |
verboseExtrapolation |
Value: false Type: Boolean Description: = true, if warning messages are to be printed if table input is outside the definition range |
u_min |
Value: getTable2DAbscissaUmin(tableID) Type: Real[2] Description: Minimum abscissa value defined in table |
u_max |
Value: getTable2DAbscissaUmax(tableID) Type: Real[2] Description: Maximum abscissa value defined in table |
u1 |
Type: RealInput[n] Description: Connector 1 of Real input signals |
|
---|---|---|
u2 |
Type: RealInput[n] Description: Connector 2 of Real input signals |
|
y |
Type: RealOutput[n] Description: Connector of Real output signals |
tableID |
Type: ExternalCombiTable2D Description: External table object |
---|