Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

Panel angle

This site may earn commission on affiliate links.
The azimuth is accounted for in the formula.
OK, it would be interesting to see the formulas you are using. Here's the answer I came up with (because the dot product is bilinear):

For a given day, consider the sun's path across the sky. Express the path as points on the unit sphere, and integrate each coordinate over the course of the day separately. [For the x coordinate (E-W) the integral will obviously be zero.] The resulting vector will no longer be a unit vector, but the optimal panel direction is pointed along that direction.

For a longer time period, you can just add up those integrated sun coordinate vectors to get the optimal panel direction. Also, if you have a shading forecast as a function of time, you can multiply the sun coordinates by the shading factor before integrating. And if you are trying to maximize economic production according to a time of use plan, you can multiply the sun coordinates by the value of electricity at each time before integrating.

Cheers, Wayne
 
@power.saver looking at your spreadsheet, for month 1 you list 22.21. This seems like a very low optimal angle considering most of your sun producing times are above that. What am I missing?
The angle reported by my program is measured from vertical. I do this because the program calculates everything in angles of elevation (of the sun). If you measure your panel angle (tilt) from horizontal, subtract those values from 90 degrees. So January has a tilt of 67.79 degrees.

solar_tilt_monthly.png
 
Last edited:
Something I'm curious about is whether it is more efficient to set the angle based on exactly high-noon, or slightly lower as the sun will be lower on either side of it.
OK, I have a simple answer to this question now (at least for the northern hemisphere above the tropic and excluding the arctic winter):

On any day, the sun path through the sky (if we ignore the earth's orbital motion) will be a planar cut of the sky hemisphere (an arc of a circle). If we call O our location (the origin), E the east compass point (90 degree azimuth, 0 degree elevation) and W the west compass point, and S the location of the sun in the sky at solar noon (180 degree azimuth, some non-zero elevation), then O-E-S (equivalently W-E-S) defines a plane P.

On the equinoxes, the sun rises at E, hits S, and sets on W, so the sun's entire path is in the plane P. That means S is the average direction of the sun, and the solar panel should be pointed at S. During the spring/summer, the sun rises north of E, hits S, and sets north of W. That means the sun's entire path is above the plane P (except at the point S of incidence), and the optimal panel elevation will also be above the point S, shifted towards the sun's path relative to P. Conversely, in the winter, the sun rises south of E, hits S, and sets south of W. So now the sun's entire path is below the plane P, and the optimal panel elevation is below the point S.

Still working on quantifying the above.

Cheers, Wayne
 
So, back to the OP question – is there a website where I can enter lat/long and date, and get optimal panel angle for that day (not just high noon angle)?
Years ago I searched for such a site but didn't find any. So I wrote a program to do the calculation for myself.

If you would like me to run it for your specific location, send me the following information:
1. Location (lat/lon or nearby city)
2. If your array is fixed, the orientation (azimuth) of the panels
3. The minimum elevation (in degrees) when the sun is on the array. This removes the time when the sun in blocked by hills, trees or buildings from the angle calculation.

I'll post a table of the tilt angle for each month.
 
I've been thinking about this question some from a purely geometric point of view, ignoring atmospheric effects. I may have an exact answer, but I don't think it's actually useful in reality, because of those atmospheric effects. It likely overvalues the contribution from times when the sun is low in the sky.

So here's a tedious way to get what should be a very accurate answer: use PVWatts. For the web application, you have to run it one tilt angle at a time, and it gives you an estimate by month of production (or you can download by hour if you like). If you're a programmer, maybe they have an API so that you could write a simple program to query it for all the tilt angles of interest.

Otherwise, you can run it, say, 10 times, for your latitude +/- 20 degrees at multiples of, say, 4 degrees. Then for each month you can look at the modeled kWh generated as a function of tilt angle. If you see an increasing trend that then reverses, you know the maximum is within that 4 degree interval, and you can run PVWatts a few more times to get the maximum down to a degree. If you don't see the trend reverse, then +/- 20 degrees wasn't broad enough, and you can extend the range on the appropriate end.

Cheers, Wayne
 
Reviving this old thread given the number of new people who have joined since.

TL/DR: Looking for a formula (or code) where I can enter lat/long and a date (YMD) then have it spit out the optimal (vertical) solar panel angle.

I've currently settled on using the SimplySolar iPhone app but would still like the ability to run the calculations on my server, especially now that I setup my RPi to automatically read the array angle. I would then be able to have the server message me when the calculated and current angles diverge enough that I should go crank the arrays.
 
TL/DR: Looking for a formula (or code) where I can enter lat/long and a date (YMD) then have it spit out the optimal (vertical) solar panel angle.
The optimal angle for that one day? Just looking at the geometry, ignoring weather and atmospheric distortion? [Although some sources may already include corrections for atmospheric diffraction.]

Then what you need are the equations for the "sun path" for that day. That is a solved problem. Discussed somewhat at Sun path - Wikipedia, including the footnotes. Other sources may have more detail or more directly the equations you want. Note that many of the treatments start with figuring out the "hour angle" based on the clock time; you can skip all of that and just think of "hour angle" as local solar time, since you are concerned with the path over the whole day, not where the sun is at a particular instant.

Once you have sun path equations (elevation and azimuth angles for a given day, hour angle, and latitude), you can numerically integrate the sunpath over the course of the day. Probably choosing the bounds of integration to be starting at some minimum elevation angle, to reflect that you have some obstructions at the horizon. You can just render the elevation and azimuth as points (x,y,z) on the unit sphere, and then integrate them in R^3. Of course, for a particular choice of axes, the sun path is symmetric about the x-axis, so that component of the integral will be 0, and you just need to calculate the integral of y and z.

Then the elevation angle for the result (y,z) is the optimal angle for the day, i.e. arctan(z/y) for the usual sense of z. If you are interested in manually adjusting your array on a fixed schedule, you'd want the optimal angle for a longer period of time. If the desire is to maximize total production, the optimal angle would be determined just by adding up those integrated daily vectors over the full time period, and then determining its elevation angle. Because the length of the day will be changing over that time period, and the integration for a given day already gives you a vector whose length reflects the total production for that day.

Cheers, Wayne
 
  • Like
Reactions: Patrick66
The optimal angle for that one day? Just looking at the geometry, ignoring weather and atmospheric distortion? [Although some sources may already include corrections for atmospheric diffraction.]

Then what you need are the equations for the "sun path" for that day. That is a solved problem. Discussed somewhat at Sun path - Wikipedia, including the footnotes. Other sources may have more detail or more directly the equations you want. Note that many of the treatments start with figuring out the "hour angle" based on the clock time; you can skip all of that and just think of "hour angle" as local solar time, since you are concerned with the path over the whole day, not where the sun is at a particular instant.

Once you have sun path equations (elevation and azimuth angles for a given day, hour angle, and latitude), you can numerically integrate the sunpath over the course of the day. Probably choosing the bounds of integration to be starting at some minimum elevation angle, to reflect that you have some obstructions at the horizon. You can just render the elevation and azimuth as points (x,y,z) on the unit sphere, and then integrate them in R^3. Of course, for a particular choice of axes, the sun path is symmetric about the x-axis, so that component of the integral will be 0, and you just need to calculate the integral of y and z.

Then the elevation angle for the result (y,z) is the optimal angle for the day, i.e. arctan(z/y) for the usual sense of z. If you are interested in manually adjusting your array on a fixed schedule, you'd want the optimal angle for a longer period of time. If the desire is to maximize total production, the optimal angle would be determined just by adding up those integrated daily vectors over the full time period, and then determining its elevation angle. Because the length of the day will be changing over that time period, and the integration for a given day already gives you a vector whose length reflects the total production for that day.

Cheers, Wayne
I just want a formula :)

I appreciate you bringing up the theory, but really looking for something plug-and-play that will give me the optimal angle for the day based on lay/long/date, and I’ll plan on adjusting weekly or so as I do now.
 
P.S. If you can create a spreadsheet with, say, 15 minute interval sun locations for the whole year, then turning that into the answers you want is not hard. I can provide some pseudo-code to do it, if my description was not sufficient.

This website will let you "print" the data for one day easily; maybe you can figure out how to dump a whole year: SunCalc sun position- und sun phases calculator.
This website offers some spreadsheets to do the sun location calculations; I haven't looked at them: ESRL Global Monitoring Laboratory - Global Radiation and Aerosols
This website probably will generate all the position data for in you one request: SOLPOS Calculator

Cheers, Wayne
 
This website probably will generate all the position data for in you one request: SOLPOS Calculator
OK, you can do this:

- Go to that website, enter your latitude and longitude, and pick dates covering a year. Choose your time frequency, say every 5-15 minutes. Pick outputs of "solar elevation angle, refracted" (which I'll call E) and "solar azimuth angle" (which I'll call A).
- Filter the results by E >= 5 degrees, say.
- For each line, define Y = -cos(A)cos(E) and Z = sin(E)
- For each day, define Ys = sum of the Y values for entries on that day, Zs similarly
- The maximum production elevation angle for that day is arctan(Zs/Ys)
- For a multi-day period, sum the values of Ys for the days in the period to get Yt, Zt similarly
- The maximum production elevation angle for that period is arctan(Zt/Yt)

Cheers, Wayne
 
Since the exact answer has been eluding folks for a few years, I think I can give the exact formulas. Basically the answer involves spherical trigonometry (not commonly used unless you do orbital mechanics or celestial navigation) and integral calculus.

You need to calculate the angle of incidence at a given moment in time, between the direction of the sun and the exact orientation of the panels (not just the tilt angle). 0 deg = pointed straight at the sun (cos = 1 = perfect irradiation), 90 deg = pointed perpendicular to the sun (cos = 0 = no irradiation). incidence angle varies by time of day of course, so you need to integrate that from sunrise to sunset (more on that later).

How do we calculate the angle of incidence at a given time? Think of a (spherical) triangle on the surface of the earth, a wedge from the center of the earth. First corner of the triangle is at the north pole. At solar noon, run a longitudinal line down towards the equator through your city. The line will intersect with your city at your city's latitude. Another line from north pole will also intersect with where the sun is above the earth, could be higher or lower latitude than your city (basically shoot a line from center of earth to sun, mark where on earth surface passes. The last line of the triangle is between these latter two points (from the sun to your city), and is the angle of incidence.

The rays from the center of earth to north pole, sun at solar noon, and your city make the three corners of our spherical triangle on the surface of the earth. At solar noon they are in a line, but over the course of a day, the corner representing your city will rotate around the north pole, so will move off that line, forming the triangle. The arc or line from the solar noon line to your city will increase as we move past solar noon, it is the angle of incidence bewteen the sun and the array, and increases as we approach sunset.

There is an exact formula for calculating that angle over the day. But wait, what about the tilt angle of the panels? What I said before would be accurate for panels pointed straight up from the center of earth through your house. To simplify things, let's only tilt due south (esp for a one-axis array). To include panel tilt, instead of shooting the ray from the center of earth through your house, follow the longitude down towards the equator by your panel angle - so shoot it through your latitude minus your panel tilt angle. That's where your panel is pointing relative to the earth.

Spherical triangles are funny. Each side (a,,b,c) of the triangle on the earth's surface is an arc, i.e. expressed as an angle. Each corner (A, B, C) of the triangle has an angle between two sides as well. A is the angle of the corner opposite line a, B is the corner opposite line b, etc. Here is the formula:
line a = line angle of incidence we're solving for, between the solar noon sun and the panel, for each time of day.
line b = line angle from north pole to sun at solar noon, and fixed for given day = ( 90 deg - e). e is declination of sun from equator for that day of year: 0 deg at equinox, 23.5 at summer solstice, -23.5 at winter solstice. More on calculating e exactly later.
line c = line angle from north pole to absolute panel direction = (90 deg - latitude + tilt), constant for a given tilt.
corner A = angle at north pole between line b and line c. A = 0 deg at solar noon (line b and c are on top of each other), A=90 deg at 6 pm, A = 180 at midnight.

Now solve for line a using law of cosines:
cos a = cos b * cos c + sin b * sin c * cos A.

Now we integrate that over the day to get the irradiation over the day. Integral of cos a * d (time) , from sunup to sunrise. Since d (A) / d (time) = fixed rotation rate of earth (360 deg / 24 hrs), we can equally integrate cos a * d(A), basically from -90 deg (approx sunup) to 90 deg (approx sunset) for a 12-hour period. But the day is not 12 hours, the exact integral from sunup to sunset, we need to integrate only when a < 90 degrees. Since you normally don't express the integral range using what you're solving for, this can get complicated.

Now we can just vary tilt angle for that day, whatever tilt achieves the highest integral is the optimal tilt angle that gives the highest energy for that day. I will suggest a 12 hour day is a good enough approximately for finding optimal tilt, since the energy near sunup/sunset is minimal. Or, since I forget my calculus, if we just divide up the day using a spreadsheet, and sum up to approximate integrals, we can zero out whenever a > 90 deg.

Finally, how do we calculate e, the declination angle of the sun for a given day of year, aside from 0 at equinox and 23.5 deg at solstices? So we can find optimal tilt for every day of the year?

We need another spherical triangle, this time a right spherical triangle.
E = declination at solstice = 23.5 deg fixed = angle of ecliptic
d = angle from equinox to current location of earth in sun orbit (0 = equinox, 90 deg = summer solstice)
Now solve for e using Napier's law for right spherical triangles:
tan e = tan E * sin d

Simpler approx of d: Since the earth travels 360 deg around sun in a year, and a year is approx 360 day (ha), d in degrees is simply the number of days from equinox. (Should be good enough from spring equinox through summer, to fall equinox. For winter months, e is negative, and b is > 90 degrees, may have to flip a sign in one of the equations).

Voila
 
Thanks @wwhitney and @wwu123. I'm now handing this thread over to my math major undergrad son to do some coding.
I'll try to put together a crude spreadsheet later this week to share....

My Model S was hit by a drunk driver Saturday night and towed to a lot. Insurance say likely total loss, so dealing with getting the police report and also trying to get my things from the car right now. Couldn't get anything done yesterday with many things closed due to national holiday.

Would be a trivial thing to get my stuff, except I realized if they closed all the doors and the car loses 12V power, it may be a huge pain to do the emergency trunk release and 12V jump. I think both the 12V and HV battery were working right after the crash, the damage was towards the front bumper, but my SOC was only around 30%, so if the car was damaged to where it won't sleep, could be pretty low SOC by now. No location or sign of activity from Tesla app nor Tessie, hopefully it's just in deep sleep and not totally dead....

P.S. The formulas and creating a spreadsheet should be trivial for your math major son....getting the mental image of the scenario in 3D from the terminology is probably what'll take him the most time, if he hasn't visualized the problem before. Give him an earth globe and some large rubber bands to make great circles, it helps a lot...
 
  • Like
Reactions: BGbreeder