?
Solved

sunrise/sunset

Posted on 1997-03-11
1
Medium Priority
?
1,334 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

649 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