Run Properties: Calendar Time

GoldSim provides a number of special reserved names, referred to as Run Properties, that can be directly referenced in expressions. Some Run Properties are associated with Calendar Time.  That is, they return information regarding the simulated date and time of a simulation.

These can be found under the “Calendar Time” folder:

   Note: Because even Elapsed Time simulations have a specified Start Time, Calendar Time Run Properties are available for both Elapsed Time and Calendar Time simulations.

The Calendar Time Run Properties are described below:

DateTime: This represents the elapsed time from a reference point (December 30, 1899 at 00:00:00 – that is, one day before the beginning of the twentieth century). It has units of time.

   Note: You can compare the DateTime Run Property to an actual calendar date by enclosing the date in quotation marks within an expression.  For example, this if statement would compare the simulated date to the specified date of 15 April 2012:  if(DateTime > “15 April 2012”, 1, 2).

Year:  This is the calendar year. It is unitless.

   Note: The Run Property “Year” (an integer representing the calendar year) should not be confused with the unit “yr” (which is defined as 365.25 days).

Quarter: This is the calendar quarter (an integer between 1 and 4), assuming the first quarter starts on January 1. It is unitless.

Month: This is the calendar month (an integer between 1 and 12). It is unitless.

   Note: The Run Property “Month” (an integer between 1 and 12) should not be confused with the unit “mon” (which is defined as 30.4375 days).

WeekOfYear: This is the week number for the current YearOfWeek (see below).  It is a unitless integer between 1 and 53.  Each week starts (and hence WeekOf Year changes) on the “first day of model week” specified in the Advanced Time Settings dialog. 

YearOfWeek:  This is the nominal year for the current WeekOfYear (see above).  It is a unitless integer. YearOfWeek is incremented at the start of the first week that has the majority of its days in the next calendar year. Thus at the beginning of the first week that starts after December 28, YearOfWeek is incremented to the next calendar year, and WeekOfYear is reset to 1.

DayOfYear:  This is the calendar day of the year (an integer number between 1 and 366). It is unitless.

DayOfMonth: This is the calendar day of the month (an integer between 1 and 31).  It is unitless.

DayOfWeek: This is the calendar day (an integer between 1 and 7). It is unitless. The weekday corresponding to the value 1 is determined by the specified “First day of model week” specified in the Advanced Settings of the Time tab of the Simulation Settings dialog.

Hour: This is the calendar hour (an integer between 0 and 23). It is unitless.

Minute: This is the calendar minute (an integer between 0 and 59). It is unitless.

Second: This is the calendar second (an integer between 0 and 59). It is unitless.

DaysInMonth: This is the number of days in the current calendar month (an integer between 28 and 31). It is unitless.

DaysInYear: This is the number of days in the current calendar year (either 365 or 366). It is unitless.

StartTime: This is the simulated Start Time for the simulation (expressed relative to December 30, 1899 at 00:00:00).  It has units of time and is generally viewed as a date.  It can be compared to other dates in expressions.

   Note: An example file which illustrates the use of Calendar Time Run Properties (RunProperties.gsm) can be found in the General Examples/ Running folder in your GoldSim directory (accessed by selecting File | Open Example... from the main menu).

   Note: The Run Properties Year, Quarter, Month, WeekofYear, DayOfMonth, DayofWeek, DayofYear, Hour, Minute and Second can be particularly useful for triggering events that must occur exactly every year, quarter, month, week, day, hour, minute or second. For example, if you had a 1 day timestep (or smaller), defining an OnChanged trigger as DayofYear or DayOf Month would force the element to be triggered every day. An example file which illustrates this (RunProperties.gsm) can be found in the General Examples/ Running folder in your GoldSim directory (accessed by selecting File | Open Example... from the main menu).

Related Topics…

Learn more about: