May 8, 200323 yr 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" Jan "Beatus ille qui procul negotiis..."
May 8, 200323 yr 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
May 10, 200323 yr 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
May 10, 200323 yr 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
February 25, 200620 yr Commercial Member 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 AviationMy Playland - I69
Create an account or sign in to comment