modelWeeklySchedule

Weekly schedule

Extends from Modelica.Blocks.Icons.DiscreteBlock (Graphical layout of discrete block component icon).

Information

This model interprets a schedule file and performs a weekly, cyclic extrapolation on the source data. An example for a schedule entry is

double tab1(3,2)
# For week-day, output 1 between 7:00 and 19:00, and 0 otherwise
mon,tue,wed,thu,fri:7:00:00  1
mon,tue,wed,thu,fri:19:00:00  0
# For week-end, output always 0
sat,sun:0:00:00 0

The first row must start with double tab1 and be followed by the number of rows (excluding comments) and number of columns, whereas the time column is considered the first column.
Lines that start with '#' are comments.
The list of week-days is separated by a comma, and ends with a colon, after which the time format for the start is listed in the format hour:minute:second. Week-day, hour, minute and second are optional fields, but if one of these fields is used, the fields coming before it in the sequence (week-day, hour, minute, second) must be used too.

By default, schedules are read from the parameter data but optionally schedules can be read from a file. The parameter columns is used to specify which columns of the table should be produced at the output y. The first column is time, hence for the above example, set columns = {2}.

See Buildings/Resources/Data/schedule.txt for an example of the supported file format.

Parameters

TypeNameDefaultDescription
Integercolumns{2}Columns of the schedule to be produced at the output y. First column is time, hence value must be 2 or larger
Modelica.Units.SI.Timet_offset0Timestamp that corresponds to midnight from Sunday to Monday
Data source
BooleantableOnFilefalse= true, if table is defined on file; false if defined through parameter data
StringfileName""Filename
Stringdata"double tab1(3,2) # For week-day, output 1 between 7:00 and 19:00, and 0 otherwise mon,tue,wed,thu,fri:7:00:00 1 mon,tue,wed,thu,fri:19:00:00 0 # For week-end, output always 0. Note that this line is redundant in this example. sat,sun:0:00:00 0"String data with weekly schedule

Connectors

TypeNameDefaultDescription
Modelica.Blocks.Interfaces.RealOutputy{getCalendarValue(cal, iCol - 1, time) for iCol in columns}Schedule values

Contents

NameDescription
getCalendarValueprotectedReturns the interpolated (zero order hold) value

Revisions

  • April 29, 2026, by Michael Wetter:
    Changed configuration of table to cause the parameters to be evaluated, as this leads to more efficient code.
    This is for IBPSA, #2111.
  • March 30 2024, by Filip Jorissen:
    Avoiding memory leaks for IBPSA, #1860.
  • April 10 2022, by Filip Jorissen:
    Added parameter source implementation.
  • March 9 2022, by Filip Jorissen:
    First implementation.