blockStepFunctionMatPeriodic

Table look-up in one-dimension (matrix/file), periodic and constant-segment interpolation

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:

  1. table1 gives, by linear interpolation of the second column, y1 = 3.3
  2. As input of table2, the integer part of [y1] = 3 is taken
  3. table2 gives, 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 u is 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:

  1. By explicit entry of parameter "table", and other parameters must be set as follows:
  2.    tableName = "NoName" or with blanks,
       fileName  = "NoName" or with blanks.
  3. 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.CombiTable1Ds documentation

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

TypeNameDefaultDescription
Realperiode20Period in X units
table1 data definition: dependent variable
BooleantableOnFile1falsetrue, if table is defined on file or in function usertab
Real[:,:]table1fill(0.0, 0, 2)table matrix (grid = first column; e.g., table=[0,2])
StringtableName1"NoName"table name on file or in function usertab (see docu)
StringfileName1"NoName"file where matrix is stored
table2 data definition: variables to be interpolated
BooleantableOnFile2falsetrue, if table is defined on file or in function usertab
Real[:,:]table2fill(0.0, 0, 2)table matrix (grid = first column; e.g., table=[0,2])
StringtableName2"NoName"table name on file or in function usertab (see docu)
StringfileName2"NoName"file where matrix is stored
Integer[:]columns22:size(table2, 2)columns of table to be interpolated

Connectors

TypeNameDefaultDescription
Modelica.Blocks.Interfaces.RealInputuInput homogeneous to the first column values of table1
Modelica.Blocks.Interfaces.RealOutput[size(columns2, 1)]yCorresponding values

Components

TypeNameDefaultDescription
Modelica.Blocks.Tables.CombiTable1DsTable1
Modelica.Blocks.Tables.CombiTable1DsTable2
BuildSysPro.Utilities.Math.IntegerExpressionPartieEntiere