|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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) + ??? Whe 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 |
#2
|
|||
|
|||
Simple Calculation of Sunset Time required
tomcee wrote:
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) + ??? Whe 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 Perhaps here http://www.math.niu.edu/~rusin/uses-math/position.sun/suncalc.ub somewhere? |
#3
|
|||
|
|||
Simple Calculation of Sunset Time required
I think you can find this on the web. Try the US Naval Observatory Site
(just stay away from Cheney's house - he's been known to shoot people). You might try 'astronomical clock' as a search term. Here's what I use with PureBasic. I use the same basic code with an embedded ZBasic ZX-40a - it uses less space than a lookup table. I think I originally got it from USNO. 'Protected' is the same as 'local' in other languages. Variables declared with .d are double precision floats; those without are 32-bit integers. DST2 & DST4 are global variables that hold the DST start/end times in hours since 0000 01-01-yyyy. Procedure GetDawnDusk() ;calculates sunrise/sunset Protected RadiansPerDegree.d,latitude.d,longitude.d,tz.d,zon e.d,lo.d,c.d,C2.d,SD.d,CD.d,sc.d,C3.d,yd,n,dawn,du sk OpenPreferences("roZetta.prf"):PreferenceGroup("Gl obal") longitude=ReadPreferenceDouble("longitude",-84.56) latitude=ReadPreferenceDouble("latitude",39.04) tz=ReadPreferenceDouble("tz",-5.00) ClosePreferences() tz=tz*-1 RadiansPerDegree=0.017453293 yd=DayOfYear(Date()) If latitude=0 If yd=Val(DST2)/24 And ydVal(DST4)/24 zone=tz-1.0 Else zone=tz EndIf Else If yd=Val(DST4)/24 Or ydVal(DST2)/24 zone=tz-1.0 Else zone=tz EndIf EndIf lo=4.8771+0.0172*(yd+0.5-longitude/360.0) c=0.03342*Sin(lo+1.345) C2=(1.0/RadiansPerDegree)*(ATan(Tan(lo + c))-ATan(0.9175*Tan(lo+c))-c) SD=0.3978*Sin(lo+c) CD=Sqr(1.0-SD*SD) sc=(SD*Sin(latitude*RadiansPerDegree)+0.0145)/(Cos(latitude*RadiansPerDegree)*CD) C3=(1.0/RadiansPerDegree)*ATan(sc/Sqr(1.0-sc*sc)) n=((6.0-zone-(longitude+C2+C3)/15.0)/24.0)*1440.0 dawn=(n/60)*100+(n%60) n=((18.0-zone-(longitude+C2-C3)/15.0)/24.0)*1440.0 dusk=(n/60)*100+(n%60) SetGadgetText(#TXT_DAWN_CFG, RSet(Str(dawn),4,"0")) SetGadgetText(#TXT_DUSK_CFG, RSet(Str(dusk),4,"0")) EndProcedure tomcee wrote: 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) + ??? Whe 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 http://davehouston.net http://davehouston.org http://tech.groups.yahoo.com/group/roZetta/ |
#4
|
|||
|
|||
Simple Calculation of Sunset Time required
"tomcee" wrote in message ... | 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) + ??? | Whe | 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 Ok, first understand the problem. Imagine (because it isn't so, but it helps) that the Earth has no tilt and moves in a perfect circle around the Sun and the Sun itself is a point of light, not a ball 1/2 a degree wide. Sunrise and sunset will be at the same time every day, 6:00 am and 6:00 pm at the equator, earlier and later as you move North or South. When you reach either Pole it will not set at all, but goes around the horizon. The function for this is the cosine of latitude, cos(90 degrees) = 0. Now we tilt the Earth, and we do so in our imagination by 90 degrees. The North pole faces the Sun on mid-summer's day, and the south pole faces the Sun 6 months later. As you know, Northern Summer is Southern Winter and vice versa. With our 90 degree tilt the Sun doesn't rise or set at the equator on mid-summer's day OR mid-winter's day, equal day and night occur mid-spring and mid-autumn. Okay, so much for latitude and tilt, next is orbital eccentricity. We imagined that the Earth moved in a perfect circle, but it doesn't. It is closest to the Sun on or about Jan 3rd at 91,000,000 miles and furthest 6 months later at 94,000,000 miles, moving in an elliptical orbit. As we did above, we again imagine an extreme case where the Earth passes very close to our point-like Sun and then 6 months later is way out near Pluto. The orbit is almost a straight line. The Earth falls toward the Sun going faster and faster (as comets do) and then swings around the back where gravity is at its greatest, climbs away again and slows as it gets toward Pluto's orbit where it stops climbing and falls once again, just as a ball thrown straight up would do. Now, when far from the Sun the Earth turns once a day, sunset and sunrise are about the same each day, but when close to the sun we have a problem with that. The Earth turns on its axis 360 degrees in what is called a sidereal day (1 sidereal day = 23.9344696 hours) and there are 366, (not 365) sidereal days in a year. http://en.wikipedia.org/wiki/Sidereal_day That is when the Earth has turned not to face the sun once a day, but to face the other stars. You will notice that the night sky has different stars directly overheard between Summer and Winter. This means that when (in our imagination) the Earth passes very close by the sun, noon, when the sun is overhead, can last for 12 hours. Look at the diagram at http://en.wikipedia.org/wiki/Sidereal_day and you'll see why. Last and least, the Sun is NOT a point. Now... the computation of Earth's orbit is something you do NOT want to do. http://mathworld.wolfram.com/KeplersEquation.html In conclusion, a look-up table is the simplest solution for you. |
#5
|
|||
|
|||
Simple Calculation of Sunset Time required
"tomcee" wrote in message ... 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) + ??? Whe 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 What level of accuracy are you looking for ? |
#6
|
|||
|
|||
Simple Calculation of Sunset Time required
On Feb 16, 7:35*pm, "Androcles" wrote:
The Earth turns on its axis 360 degrees in what is called a sidereal day (1 sidereal day = 23.9344696 hours) or 23 hours 56 minutes 04 seconds Surely there is a sane and reasonable person around who can appreciate how timekeeping astronomers transfered the Equation of Time corrected natural noon cycle to the average 24 hour cycle and when axial rotation was discovered to be the cause of the daily cycle they exploited the human devised 24 hour cycle are transfered it from 'Average' to 'Constant' without requiring an external reference. That value you give (sidereal day) requires the noon cycles to be equal in order to create a solar/sidereal fiction using the axial and orbital motions of the Earth - http://upload.wikimedia.org/wikipedi...3%A9reo.en.png To think that the work of Huygens and Harrison is in competition with the sidereal junk is apalling,- http://www.xs4all.nl/~adcs/Huygens/06/kort-E.html I cannot,cannot acount for why this most enjoyable and profound work is set aside for destructive and cartoonlike conceptions that never worked.You can openly promote the sidereal value without the slightest sign of an objection when before all of you is the jewel of Huyegns representing millenia of refinements which go into the correlation between clocks,the daily cycle and terrestrial longitudes. I never doubted that many people know exactly what went wrong but did not count on the lack of courage to change matters quickly or to intepret correctly the changing enviroment in celestial/terrestrial studies. |
#7
|
|||
|
|||
Simple Calculation of Sunset Time required
On Feb 16, 2:30*pm, "OG" wrote:
"tomcee" wrote in message ... 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) + ??? Whe 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 What level of accuracy are you looking for ?- Hide quoted text - - Show quoted text - OG: Thanks for asking; I had intended to mention this in my original post. I would like accuracy to within 5 minutes; preferably biased towards the negative so that if anything, the lights would turn on early, rather than late. Thanks in advance for your help, TomCee |
#8
|
|||
|
|||
Simple Calculation of Sunset Time required
Ask in alt.solar.photovoltaic. I know there are several people that
can point you to their own or website software to do this. Univ or Oregon website is big into this and has lots of info. "tomcee" wrote in message ... On Feb 16, 2:30 pm, "OG" wrote: "tomcee" wrote in message ... 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) + ??? Whe 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 What level of accuracy are you looking for ?- Hide quoted text - - Show quoted text - OG: Thanks for asking; I had intended to mention this in my original post. I would like accuracy to within 5 minutes; preferably biased towards the negative so that if anything, the lights would turn on early, rather than late. Thanks in advance for your help, TomCee |
#9
|
|||
|
|||
Simple Calculation of Sunset Time required
tomcee wrote:
On Feb 16, 2:30=A0pm, "OG" wrote: "tomcee" wrote in message ... My application is that I have an automation controller that has a calendar, can do calculations (including trig), but is rather memory limited. =A0Thus I would like to calculate time of sunset 'on the fly' rather than store the data table. ... Thanks for asking; I had intended to mention this in my original post. I would like accuracy to within 5 minutes; preferably biased towards the negative so that if anything, the lights would turn on early, rather than late. Thanks in advance for your help, TomCee Store monthly values and interpolate. That's likely to be the fastest and least memory intensive technique. |
#10
|
|||
|
|||
Simple Calculation of Sunset Time required
"tomcee" wrote in message ... On Feb 16, 2:30 pm, "OG" wrote: "tomcee" wrote in message ... 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) + ??? Whe 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 What level of accuracy are you looking for ?- Hide quoted text - - Show quoted text - OG: | Thanks for asking; I had intended to mention this in my original | post. I would like accuracy to within 5 minutes; preferably biased | towards the negative so that if anything, the lights would turn on | early, rather than late. | Thanks in advance for your help, | TomCee 15 entries in a look-up table, each entry reused for 12 days. 12 * 15 = 180. Day 1-12 17:10 13-24 17:25 24- 36 17:40 ... 169-180 20:20 |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ephemeris calculation | Gour | Astronomy Misc | 12 | January 16th 08 09:42 PM |
Time constant calculation for proton and electron | Jerry | UK Astronomy | 4 | May 8th 06 06:27 AM |
Earth's rotation and mass calculation | John Doe | Space Shuttle | 2 | March 4th 06 02:58 PM |
Arclength Calculation | Jon | Astronomy Misc | 1 | March 28th 04 10:06 AM |
Looking for tide calculation algorithm | Chuck S. | Astronomy Misc | 5 | October 11th 03 01:53 PM |