Jump to content
Sign in to follow this  
Guest

Sun elevation

Recommended Posts

Guest bartels

Its hours and fractional minutes, just for testing.Arne Bartels

Share this post


Link to post
Share on other sites
Guest

I have only one comment... Oh my god! Nice work, can't wait to try it out.

Share this post


Link to post
Share on other sites

Karl,Genesis 1:16 : "God created 2!! lights".Some years later Arne gave us the code for the sun!May be he can do the same for the moon, so that we can do something useful with it?Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites
Guest bartels

By the way, Karl even if the earth seems flat in FS, the lowering effect with height is modelled in FS. This time the simple trigonometry can't go wrong: with the aircraft height h and the earth radius R=6370km the apparent lowering of the horizon (or rising of the sun over horizon) is acos(1/(1+h/R)).So the formula goes into:%( (* zulutime+longitude/15 *)(P:ZULU TIME,hours) (A:PLANE LONGITUDE, degrees) 15 / + (* (7.3*sin((dayofyear-3)/365.25*360) *)(P:ZULU DAY OF YEAR,number) 3 - 365.25 / 2.0 pi * * sin 7.3 * (* -9.8*sin((dayofyear-80)/365.25*720)) *)(P:ZULU DAY OF YEAR,number) 80 - 365.25 / 4.0 pi * * sin -9.8 * + 60 / - (>L:local_sun_time,number) (* declination is the sun height over equator *)(P:ZULU DAY OF YEAR,number) 80 - 365.25 / 2.0 pi * * sin 23.45 * dgrd (>L:declin,number) (* sin(sunelev)=sin(decl)*sin(lat)+cos(decl)*cos(lat)*cos(localsuntime-12h) *)(* sin(decl)*sin(lat) *)(L:declin,number) sin (A:PLANE LATITUDE, radians) sin * (* cos(decl)*cos(lat) *)(L:declin,number) cos (A:PLANE LATITUDE, radians) cos * (* cos(localsuntime-12h) localsuntime-12h aka "hour angle" or "right ascension" of the sun *)(L:local_sun_time,number) 12 - 24.0 / 2.0 pi * * cos * + asin rddg(* curvature of the earth effect cos(lowered horizon)=1/(1+height/earth_radius) *)1.0 (A:PLANE ALTITUDE,km) 6370 / 1 + / acos rddg +(* apparent athmospheric refraction effect *)0.833 +(>L:local_sun_angle,number)(L:local_sun_time,number) d int )%!02d!:%( 1 % 60 * )%!.1f! %( (L:local_sun_angle,number) )%!.1f!Arne Bartels

Share this post


Link to post
Share on other sites
Guest bartels

Has anyone looked at the horizon at sunset at different altitudes?The horizon in Fs2002 acts really strange. I measured the touch of the sun's disk, the transit of the centre and the disappearance of the sun to the horizon. From 0ft to 500ft the horizon remains constant, from 500ft to 10000 ft it lowers slowly, at 10000ft it jumps up for about 0.5 degrees, above 10000ft it again lowers slowly. If measured over all altitudes I have the feeling that my altitude correction is pretty good, even if there are some strange jumps at 500ft and 10000ft. Two effects are independent from altitude: the blending effect of the sun (if enabled) disappears always at the same time of day, it corresponds with the transit of the sun's centre over the horizon at 0ft altitude. The sun disappears from view at about 3

Share this post


Link to post
Share on other sites
Guest

Arne,You are a gem! Thanks for the revised formula that takes altitude into account. It works splendidly! I removed the .833 + "correction factor" as you've suggested.The piece de resistance for my implementation will be a small popup that will allow the pilot to adjust the on/off points manually, but otherwise the entire gauge will be invisible and transparent to the pilot.BillAVSIM OmbudsmanFounder and Director,Creative Recycling of Aircraft Partshttp://mtco.com/~rsam/fartslogo.jpg

Share this post


Link to post
Share on other sites

I'm not Polish, so I'm clearly not smart enough to grok all the XML.I don't suppose there's a "C" version lying around anywhere? :)


Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...