Sun
and Moon calculator
This is a small application computing the sunset
and sunrise times for any given location, as well as the phase of the moon. The
methods are low accuracy methods I found in the Internet and as descibed in the
World Almanac. If you start the program you will find that the Avigo is not
really a number cruncher. So it takes a while to compute the sunset and rise
times. Here is a picture from the application as seen in the fabulous freeware
simulator by G. Vermeugen. See my introduction page on tips how
to use this simulator.
You can set the local position, which is
remembered in the application preferences. The default date and time are the
current ones. The horizon parameter describes the horizon in degrees, which is
set to -0.8333 for the spherical horizon. Normally, you will use -15 for
astronomical purposes. Civil twilight ends at -8 degrees. You need to set the
time zone for your local positions to get the GMT times translated properly.
You find the application and source code here.
I needed to program some trigonometric functions
for this application. So you find sine, cosine and their inverses in the sun
file. However, all number computations are very slow on the Avigo. Using faster
algorithms won’t help very much really, but are more work than is rewarding in
this case. You will also find computations of Julian date in the sun file.
I actually wanted to do some more astromonical
things here, but gave up because of the slowness of the double arithmetic.
There is nothing spectacular about the user
interface. The only new thing is the saving of preferences, which you will find
in the main file.