modelCalendarTime
Information
Block that outputs minute, hour, day of the month, month, year and weekday.
Assumption and limitations
The implementation only supports date computations from year 2010 up to and including 2020. Daylight saving and time zones are not supported.
Typical use and important parameters
The user must define which time and date correspond to time = 0
using the model parameters zerTim, and, if
zerTim == CDL.Types.ZeroTime.Custom,
the parameter yearRef.
The user can choose from new year, midnight for a number of years:
2010 to 2020 and also 1970.
The latter corresponds to a unix stamp of 0.
Note that when choosing the reference time equal to 0 at 1970,
the actual simulation time must be within the 2010-2020 range.
For example, startTime = 1262304000 corresponds
to the simulation starting on the 1st of January 2010 local time
when setting zerTim = CDL.Types.ZeroTime.UnixTimeStamp.
This is within the 2010-2020 range and is therefore allowed.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Buildings.Controls.OBC.CDL.Types.ZeroTime | zerTim | Enumeration for choosing how reference time (time = 0) should be defined | |
| Integer | yearRef | 2016 | Year when time = 0, used if zerTim=Custom |
| Advanced | |||
| Real | offset | 0 | Offset that is added to 'time', may be used for computing time in different time zone |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput | year | Year | |
| Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput | month | Month of the year | |
| Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput | day | Day of the month | |
| Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput | hour | Hour of the day | |
| Buildings.Controls.OBC.CDL.Interfaces.RealOutput | minute | Minute of the hour | |
| Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput | weekDay | Integer output representing week day (monday = 1, sunday = 7) |
Revisions
-
March 30, 2022, by Michael Wetter:
Increased value oflastYearas the underlying implementation allows for 21 years. -
November 12, 2020, by Michael Wetter:
Reformulated to remove dependency toModelica.Units.SI.
This is for Buildings, issue 2243. -
March 2, 2020, by Michael Wetter:
Changed icon to display dynamically the output value. -
August 20, 2019, by Filip Jorissen:
Revised implementation such that the meaning oftimeis better explained and unix time stamps are correctly defined with respect to GMT. (see Buildings, issue 1192). -
March 14, 2017, by Michael Wetter:
Refactored implementation. -
February 23, 2017, by Milica Grahovac:
First CDL implementation. -
August 3, 2016, by Filip Jorissen:
First implementation.