Astro Library

derez

Expert
Licensed User
Longtime User
Having the algorithms at hand from the Astro module (see http://www.b4x.com/forum/share-your-creations/4110-sun-amd-moon-data-gps-programs.html#post23730) I made this library which does the same as the module:

Sunrise and sunset times
Moonrise and Moonset times
Moonphase

The file includes the library, the source (cs file) so it is integrated at compilation, and a demo program that works without GPS, but the use of this library is meant for GPS to supply the coordinates and date. The second form in the demo program is actually what I use in mine.
There is also documentation.

(Please don't ask me about the algorithms - I can't explain how they work)

Edit: Updated to ver. 1.3, display of hour is always two digits. Bug correction. Only the library is included in the new zip file.
 

Attachments

  • Astro.zip
    119.1 KB · Views: 130
  • Astro1.3.zip
    12.2 KB · Views: 11
  • Astro1.3.zip
    12.2 KB · Views: 18
Last edited:

mjcoon

Well-Known Member
Licensed User
Having the algorithms at hand from the Astro module (see http://www.b4x.com/forum/share-your-creations/4110-sun-amd-moon-data-gps-programs.html#post23730) I made this library which does the same as the module:

Sunrise and sunset times
Moonrise and Moonset times
Moonphase

The file includes the library, the source (cs file) so it is integrated at compilation, and a demo program that works without GPS, but the use of this library is meant for GPS to supply the coordinates and date. The second form in the demo program is actually what I use in mine.
There is also documentation.

(Please don't ask me about the algorithms - I can't explain how they work)
Hi David; are you still "there"?

There is a minor problem with time formatting in your code in that 24-hour format should always have four digits thus HH:mm not H:mm.

But that is mere convention. Today I got a sunrise time of "7:60"! This is not valid in any convention! Are you able to correct it? I can supply the parameters that gave rise to that value if necessary for you to test.

Best regards, Mike.
 

mjcoon

Well-Known Member
Licensed User
I'll check
Wow, that's quick!

Before I forget, the parameters were: date 17 Jan 2014, lat=51.5; long=-0.75; time zone=0; zenith defaulted.

The demo program in the library zip file shows the bug with these values.

TIA, Mike.
 

mjcoon

Well-Known Member
Licensed User
Corrected, please verify.
Verified; now I get a leading zero and 08:00 instead of 7:60.

BTW My program uses astro.dll to offer arbitrary program scheduling, via Windows SchTasks.exe, relative to sun/moon rise/set times.

Best regards; happy New Year etc, Mike.
 
Top