?
Solved

sunrise/sunset

Posted on 1997-03-11
1
Medium Priority
?
1,332 Views
Last Modified: 2008-02-26
What is the algorithm for determining sunrise/sunset, moonrise, and twilight based on the date and the latitude and longitude?
0
Comment
Question by:namrepus
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
ozzy earned 200 total points
ID: 1334848
This is a complicated one but here goes....
This formula was first intended for a four bit microprocessor, so I'm sure there may be a better way to figure it.

First, have the user enter their Latitude, and whether they are North or South Latitude.  Let this be 'L'.  Have the user enter today's sunrise time.

Each month has a different formula.  Basicaly you figure out how much change there is in each month, then spread that change over the month.

NOTE:  The formulas below contain numbers in parenthesis.  If the answer from within the parenthesis is negative, set it to zero.  It will not be used if less than zero.
Sunset                               sunrise
JAN (L/2 + 13)+(L-45)+(L-49)=JMin    sub 22 then invert sign
FEB (L-8)+(L-44)+(L-55)=FMin         add 2 then invert sign
Mar (L-10)+(L-40)+(L-55)=MMin        add 18 "     "      "
Apr (L-11)+(L-42)+(L-55)=AMin        add 14 then invert sign
May (L-10)+(L-47)+(L-53)=MyMin       Sub 1   "     "     "
Jun (L/8 + 6) + (L-52) + (L-65)=JeMin  Subt 11  "  "  "
July (JMin-16) then invert sign      (JMin-10) no sign change
Aug (FMin+9) then invert sign        (FMIn-3) "   "    "
Sep (MMin + 18) then invert sign     (MMin -3)  "   "    "
Oct (AMin+14) then invert sign       (AMin+2)  "    "     "
Nov (MyMin-6) then invert sign       (Mymin+4) "    "     "
Dec (JeMIn -19) then invert sign     (JeMIn+10)  "  "  "

Example  Latitude = 10N  sunset time for Jan 1 = 6:34am  sunset time for Jan 1 = 6:53 pm
JMim = (10/2 + 13) + (10-45) + (10-49).  (10-45) anbd (10-49) end up negative, so set them to zero
JMin = 18.  this is the total number of minutes change in January.  So at the end of January the sun will set 18 minutes later or at 7:11pm

Note: If latitude = South, then invert the sign on each result. So in January at latitude 10S the JMin = -18.
Latitude is restricted from 10<= L <= 70

My hands are tired now, I must rest.....

0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question