blockStepFunctionMatPeriodic
Information
Periodic one-dimension step function defined from file or table.
Hypothesis and equations
Periodic step function in one dimension specified by 2 tables.
The period is specified by the Periode parameter.
The dependent variable (homogenous to the input) is specified in the parameter section table 1 data definition.
The independent variable to be interpolated are defined in the parameter section table 2 data definition. It can be defined how many columns of the table are interpolated. If, e.g., columns2={2,4}, it is assumed that 2 output signals are present and that the first output interpolates column 2 and the second interpolates the column 4 of the table2 matrix.
Choose either to specify the tables by file or by matrix in the same way as in the Modelica blocks for table look-up.
Consider a starting matrix table [i, j] with n rows and m columns where
the first column is ordered and represents the dependent variable and other columns represent the independent variables.
This table is split into two tables: a first table table1 [i, j]
with n rows and two columns and a second table table2 [i, j] n rows and m columns.
The first column of table 1 is equal to the first column of the original table.
The second column of table 1 is made up of the natural numbers from 1 to m.
The first column of Table 2 is equal to the second column of table 1.
Columns 2 to m of table 2 are identical to the ones in the original table.
Example and instructions for use
Considering the following matrix:
table = [0, 0, 5;
1, 1, 10;
2, 4, 7;
4, 16, 2]
split into the two following matrixes:
table1 = [0, 1; table2 = [1, 0, 5;
1, 2; 2, 1, 10;
2, 3; 3, 4, 7;
4, 4] 4, 16, 2]
Suppose that the period is 5 (Periode=5), the input u = 2.6 and columns2={3}, the output y = 7 because 2.6 belongs to [2;4[
The process is described below:
-
table1gives, by linear interpolation of the second column,y1 = 3.3 - As input of table2, the integer part of
[y1] = 3is taken -
table2gives, by linear interpolation of its third column,y2 = 7;
Note also that:
- the interpolation is effcient because the search for a new interpolation starts from the last interval used for the previous interpolation
- if the table has only one row, its values are returned regardless of the input signal value
- if the value of the input signal
uis outside the range defined by the first column of the table, for example, u> table [size (table, 1), 1] or u <table [1, 1], the corresponding value is determined by linear extrapolation from the first or last two points of the table - the first column must be strictly monotonic
A table can be defined as follows:
- By explicit entry of parameter "table", and other parameters must be set as follows:
- By reading a file "fileName" where the matrix is stored with the name specified in the parameter "tableName". Both ASCII and binary formats are possible. See details and additional information in the
Modelica.Blocks.Tables.CombiTable1Dsdocumentation
tableName = "NoName" or with blanks, fileName = "NoName" or with blanks.
Validations
Validated model - Hassan Bouia 07/2012
--------------------------------------------------------------
Licensed by EDF under a 3-clause BSD-license
Copyright © EDF 2009 - 2023
BuildSysPro version 3.6.0
Author : Hassan BOUIA, EDF (2012)
--------------------------------------------------------------
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | periode | 20 | Period in X units |
| table1 data definition: dependent variable | |||
| Boolean | tableOnFile1 | false | true, if table is defined on file or in function usertab |
| Real[:,:] | table1 | fill(0.0, 0, 2) | table matrix (grid = first column; e.g., table=[0,2]) |
| String | tableName1 | "NoName" | table name on file or in function usertab (see docu) |
| String | fileName1 | "NoName" | file where matrix is stored |
| table2 data definition: variables to be interpolated | |||
| Boolean | tableOnFile2 | false | true, if table is defined on file or in function usertab |
| Real[:,:] | table2 | fill(0.0, 0, 2) | table matrix (grid = first column; e.g., table=[0,2]) |
| String | tableName2 | "NoName" | table name on file or in function usertab (see docu) |
| String | fileName2 | "NoName" | file where matrix is stored |
| Integer[:] | columns2 | 2:size(table2, 2) | columns of table to be interpolated |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Blocks.Interfaces.RealInput | u | Input homogeneous to the first column values of table1 | |
| Modelica.Blocks.Interfaces.RealOutput[size(columns2, 1)] | y | Corresponding values |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Blocks.Tables.CombiTable1Ds | Table1 | ||
| Modelica.Blocks.Tables.CombiTable1Ds | Table2 | ||
| BuildSysPro.Utilities.Math.IntegerExpression | PartieEntiere |