.Buildings.Controls.OBC.CDL.Reals.Sources.TimeTable

Information

Block that outputs values of a time table.

The block takes as a parameter a time table of a format:

table = [ 0*3600, 0;
          6*3600, 0;
          6*3600, 1;
         18*3600, 1;
         18*3600, 0;
         24*3600, 0];

where the first column is time in seconds, and the remaining column(s) are the table values. Any number of columns can be specified. The parameter smoothness determines how the table values are interpolated. The following settings are allowed:

smoothnessDescription
CDL.Types.LinearSegments Table points are linearly interpolated.
CDL.Types.ConstantSegments Table points are not interpolated, but the previous tabulated value is returned.

The parameter extrapolation determines how the table values are extrapolated. The following settings are allowed:

extrapolationDescription
CDL.Types.HoldLastPoint Hold the first or last table point outside of the table scope.
CDL.Types.LastTwoPoints Extrapolate by using the derivative at the first or last table points outside of the table scope.
CDL.Types.Periodic Repeat the table scope periodically with periodicity (max(table[:, 1]-min(table[:, 1]))*timeScale).

If extrapolation === CDL.Types.Periodic, then the above example would give a schedule with periodicity of one day. The simulation can start at any time, whether it is a multiple of a day or not, and positive or negative.

The value of the parameter offset is added to the tabulated values. The parameters timeScale is used to scale the first column of the table. For example, set timeScale = 3600 if the first column is in hour (because in CDL, the time unit is seconds).

If the table has only one row, no interpolation is performed and the table values of this row are just returned.

An interval boundary is defined by two identical time values following each other. For example

   table = [0, 0;
            1, 0;
            1, 1;
            2, 3;
            3, 5;
            3, 2;
            4, 4;
            5, 5];

defines three intervalls: 0..1, 1..3, 3..5. Within an interval the defined interpolation method is applied (so the table outputs within an interval are continuous if smoothness = CDL.Types.LinearSegments).

Example:

  table = [0, 0;
           1, 0;
           1, 1;
           2, 4;
           3, 9;
           4, 16];
  smoothness = CDL.Types.LinearSegments;

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 via last 2 points).

Implementation

For simulation, no time events are generated within an interval in order that also intervals with many points do not reduce the simulation efficiency. If the table points are largely changing, it is adviseable to force time events by duplicating every time point (especially, if the model in which the table is present allows the variable step integrator to make large integrator steps). For example, if a sawtooth signal is defined with the table, it is more reliable to define the table as:

   table = [0, 0;
            1, 2;
            1, 2;
            2, 0;
            2, 0;
            3, 2;
            3, 2];

instead of

   table = [0, 0;
            1, 2;
            2, 0;
            3, 2];

because time events are then generated at every time point.

Building automation systems typically have discrete time semantics with fixed sampling times, and no notion of superdense time (in which a tabulated value can change without advancing time). Therefore, to implement a table with two equal time stamps, a CDL translator may parameterize a table in the building automation in such a way that the step change happens at the time indicated in the first column, whereas previous sampling times output the tabulated value at the last transition. For example,

table = [0, 0;
         1, 0;
         1, 1];
smoothness = CDL.Types.ConstantSegments;

may be converted such that a building automation system with a sampling time of 0.5 seconds outputs

  t = 0, 0.5, 1, ...
  y = 0, 0  , 1, ...

Revisions


Generated at 2024-12-28T19:26:00Z by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos