Schedule (STRUCT) ¶ TYPE Schedule : STRUCT InOut: Name Type Comment usiSwitch USINT Number of the output; Several time periods for each output are possible. [1..32] todFirstOn TOD First time from which the switch is to be switched on todLastOn TOD Last time until which the switch is to be switched on byDayFlags DAYS The day(s) in a week this switch is active
Segment (STRUCT) ¶ TYPE Segment : STRUCT InOut: Name Type sName TZ_NAME dtDate DateTime iBias INT
TimeZone (STRUCT) ¶ TYPE TimeZone : STRUCT To handle the local TIME, it is neccecary to always specify the time and date and the time zone that is currently valid. This makes it possible to convert the local time to C oordinated U niversal T ime and vice versa. UTC is Coordinated Universal Time. It is a successor to, but distinct from, Greenwich Mean Time (GMT) and the various definitions of Universal Time. UTC is now the worldwide standard for regulating clocks and time measurement. All other timezones are defined relative to UTC, and include offsets like UTC+0800 - hours to add or subtract from UTC to derive the local time. No daylight saving time occurs in UTC, making it a useful timezone to perform date arithmetic without worrying about the confusion and ambiguities caused by daylight saving time transitions, your country changing its timezone, or mobile computers that roam through multiple timezones. The following snippet exposes the definition of UTC and C entral E urope T ime/ C entral E urope S ommer T ime. VAR_GLOBAL CONSTANT /// Coordinated Universal Time gc_tzTimeZoneUTC : TimeZone := ( asgPeriod := [(sName:='UTC')] ); /// Central Europe Time gc_tzTimeZoneCET : TimeZone := ( iBias := 60 (* T#1M => minutes *) , asgPeriod := [ ( (* (CEST -> CET) - Last Sunday in Oktober at 03:00:00.000 (CEST) *) sName:='CET', dtDate := (uiMonth := 10, eWeekday := WEEKDAY.SUNDAY, uiDay := 5, uiHour := 3) ),( (* (CET -> CEST) - Last Sunday in March at 02:00:00.000 (CET) *) sName := 'CEST', dtDate := (uiMonth := 3, eWeekday := WEEKDAY.SUNDAY, uiDay := 5, uiHour := 2), iBias := 60 (* T#1M => minutes *) )] ); END_VAR Note The Bias element represents the offset from the Coordinated Universal Time (UTC). This value is in minutes. The offset growing positive in eastern direction starting from the prime meridian. The offset is growing negative in western direction starting from the prime meridian. With the data structure TimeZone it is possible to specify every timezone of the world and so the functions can handle the local time conversion and the switching from standard to day light saving period’s if necessary. Example With the following expressions the difference between the UTC time zone and an other timezone instance can be calculated. iBiasUTC_Standard := gc_tzTimeZoneCET.iBias ; iBiasUTC_Daylight := gc_tzTimeZoneCET.iBias + gc_tzTimeZoneCET.asgPeriod [PERIOD.DAYLIGHT] . iBias ; Note The time zone which the current computer is configured for, is not always the time zone suitable for displaying the current time. Therefore in the respective application, the possibility should be provided, to be able to select the “correct” time zone that is suitable for the related output option (WebVisu, LogFiles, Email, …). InOut: Name Type Comment iBias INT Offset in minutes (local time = UTC + iBias) asgPeriod ARRAY [1..2] OF Segment 1 = PERIOD.STANDARD , 2 = PERIOD.DAYLIGHT
Types ¶ DAY (Alias) DAYS (Alias) HOUR (Alias) MILLISECOND (Alias) MINUTE (Alias) MONTH (Alias) SECOND (Alias) TZ_NAME (Alias) WEEK (Alias) YEAR (Alias)
DAY (ALIAS) ¶ TYPE DAY : UINT (1..31)
DAYS (ALIAS) ¶ TYPE DAYS : BYTE See: DAY_FLAGS for the possible values of this type.
HOUR (ALIAS) ¶ TYPE HOUR : UINT (0..23)
MILLISECOND (ALIAS) ¶ TYPE MILLISECOND : UINT (0..999)
MINUTE (ALIAS) ¶ TYPE MINUTE : UINT (0..59)
MONTH (ALIAS) ¶ TYPE MONTH : UINT (1..12) 1 => January, …