Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Share Your Creations
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Share Your Creations Show your developed application to Basic4ppc community. Please include source code if possible.

Sun amd Moon data for GPS Programs

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-01-2009, 08:16 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default Sun and Moon data for GPS Programs

The attached is a module to be attached to GPS programs.
Given the coordinates and date from the GPS it calculates the Sunrise and Sunset times, the moonrise and Moonset times and the moon phase for that date with a photo of the moon.

The algorithms are translations of what I found in the net, except for the algo of the moon phase for which I used part of the algorithm of date translation from Gregorian Calendar to Hebrew calendar, and this is the most accurate algorithm.

(If you are interested in the Hebrew calendar - ask me for the full algo).

The main module in the attachment is just a tool to run the module, instructions for the integration appear in the header of the module.
There are provisions for use with either GPS.dll or GPSDriver.dll



The photos should be put with their "moons" directory next to the application.

Happy navigation !

Updated to ver 2, to make the module independent of the type of GPS library.

After Alfcen remark, I updated it to ver 3 to be able to work independently of any other gps related code, with gpsdriver.

Edit: see in #16 updated and corrected astro.bas module, after bugs found by Agraham and Jony. Thanks.
Attached Files
File Type: zip astro3.zip (103.9 KB, 126 views)
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 10-04-2009 at 06:29 PM.
Reply With Quote
  #2 (permalink)  
Old 04-04-2009, 02:51 PM
Standa's Avatar
Junior Member
 
Join Date: May 2007
Location: Czech Republic
Posts: 38
Send a message via MSN to Standa
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Thank you very much. Algorithm in your example is first after long time, what is really working . I write program using your example. I hope in two days I put it here .
__________________
BlackBerry 8900, Dell Streak, SE MBW-150
Reply With Quote
  #3 (permalink)  
Old 04-19-2009, 05:30 AM
alfcen's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Okinawa, Ryukyu Islands
Posts: 810
Send a message via Skype™ to alfcen
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hi David,
I've been absent from the forum for a couple of months and was excited at
finding your Sun and Moon application (which I haven't checked yet as I
can't get a GPS fix right now - not a problem of your program).

At the time when the GPSDriver.dll became available I have written a similar application purely with astronomy and Google Earth in mind, which you can see and download here:
alfcen - gps astro

As soon as I get my GPS running I will get back to you. Perhaps we can exchange a few thoughts without going too deep into the algorithm.

Cheers
Robert
Reply With Quote
  #4 (permalink)  
Old 04-19-2009, 05:58 AM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Welcome back Robert, I wondered what has happened to you, not responding to my cry for help

Quote:
"Does anybody know a link to the moon rise and set calculation in VB or C ? I found one in basic and it does take a long time to convert it... ALFCEN ?"
but as you see I found the solution.

I am waiting your (and anyone elses) comments and ideas for improvements.

Edit
Checked your program vs mine:
In yours sunrise is 06:07 while at mine is 06:12
sunset is 19:14 vs 19:08
It might be due to different definitions of rise and set, as angles above horizon.
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 04-19-2009 at 12:02 PM.
Reply With Quote
  #5 (permalink)  
Old 04-19-2009, 02:27 PM
Basic4ppc Veteran
 
Join Date: Jan 2009
Location: Bayern, Germany
Posts: 489
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hi Mr. Derez

First I would like to thank you again for the felp on the SR/SS matter.
After a few changes and trys and reworking the code with the help from Klaus, it is working at 99.9 %. Plus minus 1 min.
As you know i am new with the GPS Algos., and new user Basic4ppc. But, not new with using a Compass out in the Field. I think you are correct when you think that this has something to do with different definitions of rise and set, as angles above horizon. I do not think there is a 100% Algo for SR/SS and MR/MS. Had a chance to few different source code on this.

take care and best Regards,
William
Reply With Quote
  #6 (permalink)  
Old 04-21-2009, 03:57 AM
alfcen's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Okinawa, Ryukyu Islands
Posts: 810
Send a message via Skype™ to alfcen
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hello David

Couldn't test yours. After selecting GPSDriver, all I get to is a [Astro] button.
No effect on click. GPS up and running. Sure I missed something

My algorithm takes into account atmospheric refraction and altitude
as well as the sun's apparent diameter at its current distance.
Sunrise and set is when the upper limb of the sun's disk is coincident
with an ideal horizon.

I checked it with a local tide calendar. Rise is +/- 2 min, set is pinpoint.
The same algorithm is pinpoint also for rise in a VB6 app.
Need to look further into this.

Cheers
Robert
Reply With Quote
  #7 (permalink)  
Old 04-21-2009, 06:40 AM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Alfcen
It didn't work for you because you have not completed all gps code which is required. My comment " assuming..." meant that you have to complete it.
anyway - I have updated it to version 3 (in the first post) and now it should work with gpsdriver.

I don't know what the algorithm is based on, I think I reduced it to the minimum so yours is probably better. I know it does not take altitude into the calculation.
__________________
David Erez
Ramat Hasharon, Israel
Reply With Quote
  #8 (permalink)  
Old 10-03-2009, 12:04 AM
Junior Member
 
Join Date: Sep 2009
Posts: 13
Default

Hi. Can you make a diferent version which will work without gps? To insert date ,Latitude , Longitude and have the result?
Also, what is the Astro.bas file ? I am newbe and dont understand that much.. ). It looks as basic4ppc , but not completed and i cant run it.. I tried to make it in a basic4ppc form, but i have errors , (Mimg is used before it is assigned any value, the same for Sunandmoon, etc.. )
I need a program that i give date ,Latitude , Longitude from a form, and have Sunrise and Sunset times, the moonrise and Moonset times and the moon phase. If anyone can help.. Thanks ,

Last edited by jony : 10-03-2009 at 08:48 AM.
Reply With Quote
  #9 (permalink)  
Old 10-03-2009, 04:33 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Jony
The astro.bas is a module, attached to my GPS navigation program.
The great idea of modules is that you can take it and attach it to other programs, using a minimal interface.
This means that it will be very easy for me or for anyone else to do what you ask for.

Can you wait few days ?
__________________
David Erez
Ramat Hasharon, Israel
Reply With Quote
  #10 (permalink)  
Old 10-03-2009, 09:04 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default No GPS Astro

I attach the modified Astro3 program, to work without GPS.

The date format is 3.10.2009
Lat and Long are decimal (e.g 34.82)
This can be changed in the main program.
Attached Files
File Type: zip NoGpsAstro.zip (104.2 KB, 45 views)
__________________
David Erez
Ramat Hasharon, Israel
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How i can run my programs on smartphone? UnitZ Questions (Windows Mobile) 6 12-14-2008 03:42 PM
programs for Iphone Apple mircome Questions (Windows Mobile) 3 10-14-2008 07:15 AM
Can I do programs in background colin9876 Questions (Windows Mobile) 1 12-18-2007 07:33 AM
Simple Programs to help in the gym XerVision Share Your Creations 2 07-27-2007 05:39 AM
Programs sometimes fail to load mwaite Questions (Windows Mobile) 7 06-14-2007 12:36 PM


All times are GMT. The time now is 12:13 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0