[Home] [Puzzles & Projects] [Delphi Techniques] [Math topics] [Library] [Utilities]
Here's a program demonstrating most of the capabilities of a Delphi TAstronomy unit. These include:
Background & Techniques
Most of the code in this program is a direct translation of Basic code published by Peter Duffett-Smith in his book "Astronomy with your Personal Computer", Second Edition, Cambridge University Press, 1990. The above link will take you to the Amazon site where there are a few used copies available (as of 11/5/03) in the $5 -$10 price range. In addition to the code, each routine in the book is preceded by a few pages describing the function with much more clarity than I ever could. Planetary motion is complex and analytical solutions don't exist for many problems. In these cases, curve fit solutions, with lots (!) of numeric values provide the answer.
Rank beginners will be satisfied with the default time and coordinate system options. Times are input and reported in "local time", Greenwich Mean Time (also known as Universal time) adjusted for time zone and Daylight Savings time. Viewing location coordinates are input using geographical longitude, latitude, and height above sea level. And coordinates by default are reported in the "horizon" system which locates an object in the sky by measuring the angle from North clockwise around the horizon (azimuth), and then the angle above the horizon (altitude).
Other time systems derive from the fact that our years really have an extra "hidden" day each year which we never see. Viewed from a fixed position in space, we would see that the earth actually rotates 366.25 times per year! And our days in "star time" (Sidereal time) are about 4 minutes shorter that we think they are. Sidereal time, by the way, also comes in two flavors: Greenwich Sidereal Time and Local Sidereal time.
Think of it this way, if the earth rotated one time per year, so that say, Southwest Virginia always faced the Sun, we would never see a sunrise or sunset, and would have zero days in a "year", but a space observer would see that we had one day (one revolution) per year. Thus the "lost day". Fascinating stuff. Pick up the Duffett-Smith book or an introductory Astronomy text to learn more about this as well as lots more other about coordinate systems such as Equatorial, Ecliptic, and Galactic. Each system defines measures similar to azimuth and altitude but measured from planes other than the horizon ( plane of the earth's equator for Equatorial, plane of the planetary orbits for Ecliptic, and plane of our galaxy for Galactic).
I'll warn you that, while I tested each of the converted routines against Duffett-Smith's test results as they were coded, I have not none much testing using other than the default time and coordinate systems once routines were integrated into the TAstronomy unit. Bug reports will be appreciated, and I'll do my best to correct them.
Non-programmers are welcome to read on, but may want to jump to bottom of this page to download the executable program now.
The conversion involved manual transcription of page after page of Basic code that looks like this random sample of a few lines in Delphi from the Nutate procedure: (Nutation is one of the ways that the earth wobbles on its axis.)
Maybe a thousand additional lines of similar code complete the computational portion of the unit.
There is nothing else particularly complex in the code although well over 3000 lines of code make it one of the larger program posted here. And if an error needs to be corrected, debugging can be a bit tedious because intermediate results are difficult to verify.
I replaced Duffett-Smith's date calculations with standard Delphi date-time fields which required changes to the procedures in a few places. And graphic displays were added showing Sun and Moon rise and set locations and Moon phase and Analemmas. . These are similar to those previously posted for solar info only in our Solar Position program
Addendum January 31, 2007: A viewer last month asked for the addition of "Twilight" times. I finally got around to it today. Twilight is the time before sunrise or after sunset where some visibility exists. Such regulations as VFR (Visual Flight Rules) and hunting use twilight to define daylight times when a pilot can fly or a hunter hunt. It turns out that, as in most things astronomical, there are multiple definitions.
. All three versions are now listed in the sun position statistics.
April 19,2015: Version 2 of The AstroDemo program posted today has two new features:
Suggestions for Further Explorations
Copyright © 2000-2017, Gary Darby All rights reserved.