Jump to content
Sign in to follow this  
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>


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

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!


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

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...