267-SunriseSunset-axi Application Note
Technical Support Guide
Table of Contents
Brand:
- AMX
Models:
- Netlinx
Overview:
The application note applies to:
ASTRO_CLOCK Astronomical clock function and Netlinx Sunrise and Sunset Times.
This include file wraps the Netlinx ASTRO_CLOCK function with a virtual device to provide pushes and channel status for sunrise and sunset times. It also implements Daylight Savings Time, as the astronomical clock function is tied to both time and time zone information. The DLS portion of the code can be turned off for parts of the country that do not subscribe to DLS.
Usage:
Include SunriseSunset.axi into your program.
Create a virtual device for the Sunrise Sunset functions.
Call Sunrise Sunset and pass in your Virtual Device, Longitude, Latitude, Time zone, and Daylight Saving Preference.
Events Triggered:
Channel 1, on the virtual device, will provide a push and ON channel status from sunrise to sunset time.
Channel 2, on the virtual device, will provide a push and ON channel status from sunset to sunrise time.
Channel 3, on the virtual device, will provide a push and ON channel status when the time zone changes from standard to daylight savings time.
Channel 3, on the virtual device, will provide a release and OFF channel status when the time zone changes from daylight savings time to standard.
Example Code :
(**********************************************************)
(* DEVICE NUMBER DEFINITIONS GO BELOW *)
(**********************************************************)
DEFINE_DEVICE dvVIRT = 33001:1:0
(**********************************************************) (* INCLUDE FILE GOES BELOW *)
(**********************************************************)
#INCLUDE 'SunriseSunset.axi'
(**********************************************************)
(* THE ACTUAL PROGRAM GOES BELOW *)
(**********************************************************)
DEFINE_PROGRAM
CALL 'SunriseSunset' (dvVIRT,-96.8,32.8,-6,1)
PUSH[dvVIRT,1]
SEND_STRING 0,"DATE,' SUNRISE=',TIME"
PUSH[dvVIRT,2]
SEND_STRING 0,"DATE,' SUNSET=',TIME" PUSH[dvVIRT,3]
SEND_STRING 0,"DATE,' DLS ACTIVE'"
RELEASE[dvVIRT,3]
SEND_STRING 0,"DATE,' DLS INACTIVE'"
(**********************************************************)
(* END OF PROGRAM *)
(* DO NOT PUT ANY CODE BELOW THIS COMMENT *)
(**********************************************************)Longitude and Latitude
Longitude and latitude information can be found on many websites. You can try to search your favorite search engine site for a calculator. Below is a quick list of US cities and their coordinates:
| Name | Latitude | Longitude |
| Salt Lake City, UT | 40.8 | -111.9 |
| New York, NY | 40.7 | -73.9 |
| Miami, FL | 25.8 | -80.2 |
| Fort Lauderdale, FL | 26.1 | -80.2 |
| Buffalo, NY | 42.9 | -78.8 |
| Spanish Fork, UT | 40.1 | -111.7 |
| Atlanta, GA | 33.8 | -84.4 |
| Austin, TX | 30.3 | -97.7 |
| Baltimore, MD | 39.3 | -76.6 |
| Boston, MA | 42.3 | -71.1 |
| Chicago, IL | 41.9 | -87.7 |
| Cleveland, OH | 41.5 | -81.7 |
| Dallas, TX | 32.8 | -96.8 |
| Denver, CO | 39.7 | -105 |
| Houston, TX | 29.8 | -95.4 |
| Kansas City, MO | 39 | -94.5 |
| Las Vegas, NV | 36.2 | -115.2 |
| Los Angeles, CA | 34.1 | -118.4 |
| Nashville, TN | 36.2 | -86.8 |
| New Orleans, LA | 30 | -90.1 |
| Orlando, FL | 28.5 | -81.4 |
| Philadelphia, PA | 40 | -75.2 |
| Phoenix, AZ | 33.5 | -112.1 |
| Pittsburgh, PA | 40.4 | -80 |
| Portland, OR | 45.5 | -122.7 |
| San Antonio, TX | 29.4 | -98.5 |
| San Diego, CA | 32.8 | -117.1 |
| San Francisco, CA | 37.8 | -122.4 |
| San Jose, CA | 37.3 | -121.9 |
| Seattle, WA | 47.6 | -122.3 |
| St. Louis, MO | 38.6 | -90.3 |
| Washington, D.C. | 38.9 | -77 |
NOTE:
If you need to implement sunrise/sunset a lot and are a user of AOL's Instant Messenger service, try adding the user zipcodebot to your buddy list. If you send this "user" a zip code, it will respond with the latitude/longitude.
Table of Contents