TimeTable

Generate a (possibly discontinuous) signal by linear interpolation in a table

    TimeTable

Library

Modelica/Blocks/Sources

Description

This block generates an output signal by linear interpolation ina table. The time points and function values are stored in a matrixtable[i,j], where the first column table[:,1] contains thetime points and the second column contains the data to be interpolated.The table interpolation has the following properties:

  • The interpolation interval is found by a linear search where the interval used in the last call is used as start interval.
  • The time points need to be monotonically increasing.
  • Discontinuities are allowed, by providing the same time point twice in the table.
  • Values outside of the table range, are computed by extrapolation through the last or first two points of the table.
  • If the table has only one row, no interpolation is performed and the function value is just returned independently of the actual time instant.
  • Via parameters shiftTime and offset the curve defined by the table can be shifted both in time and in the ordinate value. The time instants stored in the table are therefore relative to shiftTime.
  • If time < startTime, no interpolation is performed and the offset is used as ordinate value for the output.
  • If the table has more than one row, the first point in time always has to be set to 0, e.g., table=[1,1;2,2] is illegal. If you want to shift the time table in time use the shiftTime parameter instead.
  • The table is implemented in a numerically sound way by generating time events at interval boundaries. This generates continuously differentiable values for the integrator.
  • Via parameter timeScale the first column of the table array can be scaled, e.g., if the table array is given in hours (instead of seconds) timeScale shall be set to 3600.

Example:

   table = [0, 0;            1, 0;            1, 1;            2, 4;            3, 9;            4, 16];If, e.g., time = 1.0, the output y =  0.0 (before event), 1.0 (after event)    e.g., time = 1.5, the output y =  2.5,    e.g., time = 2.0, the output y =  4.0,    e.g., time = 5.0, the output y = 23.0 (i.e., extrapolation).

TimeTable.png

Parameters

TimeTable_0

NameLabelDescriptionData TypeValid Values

mo_table

table

Table matrix (time = first column; e.g., table=[0, 0; 1, 1; 2, 4])

Matrix of size Mx2

mo_timeScale

timeScale

Time scale of first table column

Scalar

mo_offset

offset

Offset of output signal y

Scalar

mo_startTime

startTime

Output y = offset for time < startTime

Scalar

mo_shiftTime

shiftTime

Shift time of first table column

Scalar

mo_last

last

last

Structure

mo_last/fixed

fixed

Cell of scalars

true
false

mo_last/start

start

Cell of scalars

mo_nextEvent

nextEvent

nextEvent

Structure

mo_nextEvent/fixed

fixed

Cell of scalars

true
false

mo_nextEvent/start

start

Cell of scalars

mo_nextEventScaled

nextEventScaled

nextEventScaled

Structure

mo_nextEventScaled/fixed

fixed

Cell of scalars

true
false

mo_nextEventScaled/start

start

Cell of scalars

TimeTable_1

NameLabelDescriptionData TypeValid Values

mo__nmodifiers

Number of Modifiers

Specifies the number of modifiers

Number

mo__modifiers

Modifiers

Add new modifier

Structure

mo__modifiers/varname

Variable name

Cell of strings

'a'
'b'
'timeScaled'

mo__modifiers/attribute

Attribute

Cell of strings

'start'
'fixed'

mo__modifiers/value

Value

Ports

NameTypeDescriptionIO TypeNumber

y

implicit

Connector of Real output signal

output

1

See Also