Simple Calculation of Sunset Time required

Given a table of sunset times, such as:

Day # Sunset (H:M):

--------- ----------

1 17:10 2 17:11 . . . 180 20:21 ... 365 17:10

and plotting this data (of course converting H:M to Decimal hours), we get a somewhat sinusoidal relationship between the Day and time of Sunset: Sunset = f(Day); or more specifically: Sunset = f(A*sin(k*D- P) This of course is not a pure sinusoid. Observation shows that it has a significant 2nd harmonic component.

My application is that I have an automation controller that has a calendar, can do calculations (including trig), but is rather memory limited. Thus I would like to calculate time of sunset 'on the fly' rather than store the data table.

I would like an equation that yields Sunset as a function of day number. I would like to keep it simpler than the generic formula given latitude and longitude. I would like the formula from the tabular data.

It appears to have the form:

Sunset = K + A1*sin(k*D-P1) + A2*sin(2*k*D-P2) + ??? Where: D = Day number K, A1, A2, k, P1, P2 are constants determined by Long/Lat.

Has anyone determined the basic functions contained within this 'Sunset function'? Given the basic functions, I can then calculate the constants. Thanks in advance for your help, TomCee

read more and respond »

Posted 5 years ago by tomcee in General Home Automation

Report misuse

Image for Simple Calculation of Sunset Time required