Solved

sunrise/sunset

Posted on 1997-03-11
1
1,322 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Convert Jpg /PNG To GIF 5 103
Delphi Form ownership 4 54
Dev Express grid collapse 2 34
Delphi inherited method 6 42
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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

760 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now