The RTC (Real-Time Clock) of the controller is considered as UTC (Coordinated Universal Time). The biases for the selected timezone and the current period (standard time or daylight saving time) are added in the application program.
In this application example, three timezones have been pre-defined:
Central European time (UTC+1)
North American Central time (UTC-6)
Australian Eastern time (UTC+10)
The pre-defined timezones can be adapted to your application needs or you can configure one or more additional timezones. The desired timezone can be selected from the controller application.
The timezone configurations and the selection of the timezone are stored as persistent variables, in the non-volatile memory of the controller. Therefore, they are retained when an application download is performed.
In addition, the offset for the calculation of the local time and the calculated dates for switching between standard and daylight saving time are stored in the file system of the controller.
The application example implements a visualization with the Logic Builder within the EcoStruxure Machine Expert software which provides:
Status controller tab to monitor the current settings
Switchable control tab to set up the timezone configuration, set the RTC manually or to synchronize the RTC with a time server
The main features of this application example include:
Visualization for monitoring and control the RTC of the controller
Selection between three pre-defined timezones
Conversion of the local time to UTC based on the selected timezone
Set the RTC of the controller based on the local time
Synchronize the RTC of the controller with a time server over the network using the SNTP (Simple Network Time Protocol) client
Cyclic reading of the RTC of the controller
Conversion of UTC to the local time based on the selected timezone
Output of current time and date in UNIX time format
Output of current time and date in a structured and ergonomic format
Output of the calculated switching limits for the daylight saving time
Adjusting a weekly drift for the RTC of the controller
Monitoring the status of the controller backup battery