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
Solved

sunrise/sunset

Posted on 1997-03-11
1
1,326 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
1 Comment
 
LVL 1

Accepted Solution

by:
ozzy earned 100 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

856 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