Archived

This topic is now archived and is closed to further replies.

n4gix

Sun Elevation (XML Script Recovered)

Recommended Posts

Due to the age of the original topic, along with several forum crashes over the years, I went back and recovered the XML script that was collaboratively developed back in 2003 for calculating the sun angle:

 

<String>
 %( (* 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)
 (* 23.5*sin((dayofyear-80)/365.25*360) *)
 (P:ZULU DAY OF YEAR,number) 80 - 365.25 / 2.0 pi * * sin  23.5 *
 (* (abs(lat)-90)*cos(localsuntime/24*360) *)
 (L:local_sun_time,number) 24.0 / 2.0 pi * * cos90
 (A:PLANE LATITUDE, degrees) abs - *(A:PLANE LATITUDE, degrees) 0 >
   if{ - }
   els{ + }
 (>L:local_sun_angle,number)(L:local_sun_angle,number))%!.4f!
</String>

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Another version, with time

 

(P:ZULU TIME,hours) (A:PLANE LONGITUDE,degrees) 15 / +
(P:ZULU DAY OF YEAR,number) 3 - 365.25 / 2.0 pi * * sin 7.3 *
(P:ZULU DAY OF YEAR,number) 80 - 365.25 / 4.0 pi * * sin -9.8 * + 60 / -
(>L:local_sun_time,number)

(P:ZULU DAY OF YEAR,number) 80 - 365.25 / 2.0 pi * * sin 23.45 * dgrd
(>L:declin,number)
(L:declin,number) sin (A:PLANE LATITUDE,radians) sin *
(L:declin,number) cos (A:PLANE LATITUDE,radians) cos *
(L:local_sun_time,number) 12 - 24.0 / 2.0 pi * * cos * + asin rddg 1.0
(A:PLANE ALTITUDE,km) 6370 / 1 + / acos rddg + int
(>L:local_sun_angle,number)

Share this post


Link to post
Share on other sites

Thanks, Jan. Someone at FS Developer was asking about this yesterday, and I remembered this discussion and collaborative effort from so many years ago. It's fortunate that most of the thread remains more-or-less intact after several forum crashes, not to mention forum software changes!

Share this post


Link to post
Share on other sites