Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

I Solar panel angle to the Sun

  1. Sep 11, 2018 #1
    Moved into a house with some solar panels facing due south and some facing due west. Our latitude is 33.8 North in California. We are in the Mojave desert with very little cloud cover. The angle of the roof is 22 degrees from horizontal.

    What is the equation that will accept the azimuth and elevation of the sun, combine with the azimuth and elevation of the panels, and determine the angle of the sun from the solar panel perpendicular.

    Everything found so far requires two vectors. This is not two vectors, it is two angles.

    For example suppose some hours after solar local noon when the sun is at 45 degrees azimuth from the south and be 40 degrees from horizontal. The panel has an azimuth of due south (45 from the sun) and an elevation 22 from the horizontal. How many degrees is the sun from a perpendicular from the solar panel?
  2. jcsd
  3. Sep 11, 2018 #2


    Staff: Mentor

    You can convert the angles to vectors. The azimuth gives a relation between the two horizontal components and the elevation gives you the vertical component. Normalize the vector to get a third constraint on the three components.
  4. Sep 11, 2018 #3


    User Avatar
    Science Advisor

  5. Sep 13, 2018 #4
    I don't know how to work with vectors that are three dimensional, meaning two angles and a length. I am not interested in the length. The length of the vector to the sun is 93 million miles and the length of the vector representing the panel is infinite.
    I already did the google search and find many places that tell me the optimum panel angle, but none that describe what I want. I refer back to the OP and the fourth paragraph. How is that solved?

    In addition to the angle arithmetic I need the calculate the angle to the sun and any time and any day. This site comes the closest: http://success.homerenergy.com/energy-resource/angle-of-incidence/ but their equation does not make sense. It states that the solar declination is calculated by:
    declination = (23.45 degrees) * sin( (360 degrees) * (284 + n ) / 365 )
    I don't understand their meaning of ( x degrees ) multiplied by (some number) I put it into an Excel workbook and my answers were obviously not correct.
    The phrase (284 + n) / 365 does not do the job because it begins on day 1, January first, with a value of 0.68 and evenly ramps up to 1.66 on day 360, which should be about the same as day 1.
  6. Sep 14, 2018 #5


    User Avatar
    Science Advisor

    There aren't any in the link I gave you. It is all solid geometry for which they supply the needed equations and definitions.

    The 23.45° is the tilt of the Earths axis.
    284 is related to the day of an Equinox, a day of the year that the sun is directly over the equator.
    360/365 is the number of {degrees per day} that the apparent position of the Sun shifts North or South of the Equator, due to the Earth axis tilt.

    The result is that (284+n) is the {number of days} from the Equinox to the date (day number) you enter. This {number of days} is multiplied by the {degrees per day} to yield how far in degrees the apparent Sun position (known as the Subsolar Point) is from the Equator. When the sine operator is applied, the returned value is between +1 (on June 21 for the start of Summer [Northern hemisphere]), and -1 (Dec 22 for the start of Winter). (Those are the dates the Sun appears the furthest North and the furthest South of the Equator.)

    The sine result in the range of +1 to -1 then multiplies the 23.45° of axis tilt to give a result that tells how far, in degrees, the Sun is North or South of the Equator at Solar Noon on that day.

    To finally get the Solar Elevation at you location, you then subtract your Latitude from this Subsolar Point and add 90°, the result is the Elevation of the Sun at your location at Solar Noon. (SolarElevation = SubsolarPoint - Lat + 90)

    If your spreadsheet does not give you good answers for the formula check that it is set to use degrees, not radians.

    I think everything else you need is covered in the link in post #3.

    If you are getting in this deeper than you care to, I suggest further use of on-line searches for a calculator for your specific problem.

  7. Sep 14, 2018 #6


    User Avatar
    Science Advisor

    Below is some Python code that answers you question.

    The first routine calculates the altitude and azimuth of the sun given:
    H: The sun's hour angle. H is 0 degress when the sun is due south,(local noon) and 90 degrees when the sun is due west. H changes by 15 degrees per hour.
    delta: The sun's declination. delta is +23.5 degrees on the summer solstice, -23.5 degrees on the winter solstice, and 0 on the equinoxes.
    lat: Your latitude.

    The second routine calculates the angle of the panel to the sun given:
    alts, azs: The altitude and azimuth of the sun, as calculated from the first routine.
    altp, azp: The altitude and azimuth of your panel. You said the roof is 22 degrees from horizontal, so that would be an altitude of (90 - 22) = 68 degrees. The panels pointed due south would have an azimuth of 0 degrees, and the panels pointed due west would have an azimuth of 90 degrees.

    If you don't know or have access to Python, you should be able to enter these formulas into Excel. Note that the pi/180 and 180/pi terms are for converting between degrees and radians. If you have questions, just ask.

    Code (Python):
    def AltAzfromHDelta(H, delta, lat):
        return [alts,azs]
    def AnglefromAltsAzs(alts, azs, altp, azp):
        altsm = (90.0-alts)
        altpm = (90.0-altp)
        deltaaz = (azs-azp)
        return 180.0 / pi * arccos(ctheta)
    Last edited: Sep 14, 2018
  8. Sep 14, 2018 #7


    User Avatar
    Gold Member

    I'm getting an error code in line 3.
    Where is "alt" defined?
  9. Sep 14, 2018 #8


    User Avatar
    Gold Member


  10. Sep 14, 2018 #9


    User Avatar
    Science Advisor

    Sorry, that should be alts. I also messed up the zero point of the azimuth, which is 0 degrees due south. Both errors have been corrected now my post. Let me know if you see any other issues.
  11. Sep 15, 2018 #10
    Tom G,
    Thanks for the reply. You prompted me to really dig into that formula. I have a workbook that calculates the sun’s noontime elevation for the entire year.

    Thanks for your reply. I don’t have Python. I presume your code works, but cramming everything into so few lines with no comments makes it really difficult to read and discern what it is doing and why.

    After more thought, It now seems to be than if I know the sun's azimuth and elevation then I can subtract the az and el of the panel to determine the angle of the sun to the panel. Now my next step is to calculate the azimuth and elevation of the sun for each hour of any given day. I don’t know how I will do that.
  12. Sep 16, 2018 #11


    User Avatar
    Science Advisor

    Let me try and simplify it, and if you still have questions, please ask:

    (1) The sun's declination (delta) varies through the year from +23.5 degrees to -23.5 degrees. You can either look it up, or you can calculate it from the formula:
    delta = 23.5 * sin(days from the spring equinox * 360 / 365)

    or, as you said in post #4:

    delta = (23.45 degrees) * sin( (360 degrees) * (284 + n ) / 365 )

    where n is the day of the year (Thanks to Tom.G for correcting this).

    (2) The sun's hour angle (H) varies throughout the day. It is zero degrees at local noon, and changes at 15 degrees per hour. So one hour before local noon it is -15 degrees and three hours after local noon it is +45 degrees, and so on.

    (3) Once you know the sun's declination and hour angle (and your latitude, which I assume you know), you can calculate the sun's altitude and azimuth from the following fomulas:


    (4) Next you need to know the altitude and azimuth of the point your solar panels are pointing at. For the parameters you gave these values are:

    south facing panels:
    altp = 68 degrees
    azp = 0

    west facing panels:
    altp = 68 degrees
    azp = 90 degrees

    (5) Now given the altitude and azimuth of the sun and the altitude and azimuth of the panel, you have two points on the sky, and you can calculate the angle between them. This is a problem in spherical trigonometry and is not given by simply taking the difference in altitude and the difference in azimuth. The formula for the angle is:

    angle = arccos(cos(90-alts)*cos(90-altp)+sin(90-alts)*sin(90-altp)*cos(azs-azp))

    or, more simply:

    angle = arccos(sin(alts)*sin(altp)+cos(alts)*cos(altp)*cos(azs-azp))

    Please ask if there are parts you don't understand.
    Last edited: Sep 16, 2018
  13. Sep 16, 2018 #12


    User Avatar
    Science Advisor

    An added term and a little bit of history.
    Don't you need: delta = 23.5 * sin([days from spring equinox] * [degrees per day])
    With [degrees per day] = [360/365] and,
    [days from spring equinox] = (day of year) -81 Note: Spring equinox is on year day 81

    This is shown in post #4 as:
    Where the "+ 284" is an optimization that originally was "- 81". Since the sin function wraps at 360°, the end result is the same, with the advantage that addition is simpler than the subtraction when calculating manually.
  14. Sep 16, 2018 #13


    User Avatar
    Science Advisor

    Of course. Thanks for the correction. I edited my post.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?