You are on page 1of 3

Astronomical_Clock_for_Micro800

Astronomical Clock
Description:

Calculates sunrise time and sunset time based on current date and user location.

Arguments:

Parameter Parameter Type Data Type Description


Function block enable.
FBEN Input BOOL When FBEN = TRUE, execute function.
When FBEN = FALSE, do not execute function.
YEAR Input DINT Year of the current date.
MONTH Input DINT Month of the current date.
DAY Input DINT Day of the current date.
LATITUDE Input LREAL Latitude of the user (in degree).
LONGITUDE Input LREAL Longitude of the user (in degree).
GMT_HOUR Input DINT Hour (+/- hh) of the time zone (+/- hh:mm GMT).
GMT_MINUTE Input DINT Minute (mm) of the time zone (+/- hh:mm GMT).
FBENO Output BOOL Function block enable out.
LOCAL_RISE Output TIME Sunrise time (local time).
LOCAL_SET Output TIME Sunset time (local time).
Application Example:

Astronomical Clock 1
Astronomical_Clock_for_Micro800

System Description:

The diagram above shows a lighting control system. The purpose of this sytem is turn on and off the light
automatically in order to save energy. The lighting will turn off automatically when sunrise. Meanwhile,
when sunset, the lighting will turn on automatically.

Sample Function Block Diagram:

The diagram above is a function block diagram shows the sample code for lighting control system using
astronomical clock. The diagram contains one pre-defined function block "Astronomical Clock" and one user
defined function block "Lighting Control".

For "Lighting Control" user defined function block, it is used to control output based on the sunrise and
sunset time. OP1 will turn on when sunrise and turn off when sunset. Meanwhile, OP2 will be oppositve with
OP1, OP2 will turn on when sunset and turn off when sunrise.

Extended User Interface


Description:

This function block can be used to read key status on the optional LCD module then give input to the
astronomical clock and display the current time, sunrise and sunset time on the optional LCD module. Note:
This function is supported by the Micro810 controller only.

Extended User Interface 2


Astronomical_Clock_for_Micro800

Arguments:

Parameter Parameter Type Data Type Description


Function block enable.
FBEN Input BOOL When FBEN = TRUE, execute function.
When FBEN = FALSE, do not execute function.
LOCAL_RISE Input TIME Sunrise time (local time).
LOCAL_SET Input TIME Sunset time (local time).
FBENO Output BOOL Function block enable out.
YEAR Output DINT Year of the current date.
MONTH Output DINT Month of the current date.
DAY Output DINT Day of the current date.
LATITUDE Output LREAL Latitude of the user (in degree).
LONGITUDE Output LREAL Longitude of the user (in degree).
GMT_HOUR Output DINT Hour (+/- hh) of the time zone (+/- hh:mm GMT).
GMT_MINUTE Output DINT Minute (mm) of the time zone (+/- hh:mm GMT).
Connection with Astronomical Clock:

The diagram above shows a connection between 2 function blocks.

References
Sunrise Equation - Wikipedia, the free encyclopedia
NOAA Improved Sunrise/Sunset Calculation

References 3

You might also like