Solar incidence angle calculation

Posted on
Sun Jan 01, 2017 11:30 am
FlyingDiver offline
User avatar
Posts: 7215
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Solar incidence angle calculation

Ran across this old (locked) topic: viewtopic.php?f=18&t=9965&hilit=sun+angle

Probably will need to install PyEphem first ("sudo pip install ephem").

Code: Select all
import ephem

azimuth    = indigo.variables[717359973] # "Azimuth"
elevation  = indigo.variables[719196174] # "Elevation"

(lat, long) = indigo.server.getLatitudeAndLongitude()

obs=ephem.Observer()
obs.lat=str(lat)
obs.long=str(long)
sun = ephem.Sun(obs)

indigo.variable.updateValue(azimuth, str(float(sun.az) * 57.2957795))      # converted from Radians to Degrees
indigo.variable.updateValue(elevation, str(float(sun.alt) * 57.2957795))

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Jan 04, 2017 2:05 am
rhanson offline
Posts: 192
Joined: Apr 30, 2013

Re: Solar incidence angle calculation

Not sure if you were aware... Perry did end up creating the Cynical Weather plugin, and you can create multiple devices for each area of the house, and determine an elevation for a given azimuth. I use it to determine when the sun sets behind a hill. In some seasons, the sun sets right over the crest of the hill, and at other times, the sun sets next to the hill. The plugin device cuts thru all that and enables me to reliably know when it might be getting dark. :-)

Posted on
Wed Jan 04, 2017 7:13 am
johnpolasek offline
Posts: 911
Joined: Aug 05, 2011
Location: Aggieland, Texas

Re: Solar incidence angle calculation

The plugin device cuts thru all that and enables me to reliably know when it might be getting dark.
But don't cloudy days mess with the reliability? I've found the Z-wave motion detectors with luminescence reporting do an even better job...

Posted on
Thu Jan 05, 2017 2:46 am
rhanson offline
Posts: 192
Joined: Apr 30, 2013

Re: Solar incidence angle calculation

He actually addresses cloud cover in some way, but I can't recall how. I compensate for that as well by testing for cloud cover > 50% (the Dark Sky API is pretty decent with frequent updates). Even better is monitoring where the clouds are, because overcast at 12000 is far different than overcast at 800 ft. So I blend that in as well.

Which z-wave modules do you use? I've always found that they report way too infrequently to rely upon. Although all of the ones I tried were battery powered. Maybe if they have continuous power, they report more often. versions Plus, when a light is on in the room, they indicate that brightness, which may or may not be what you want.

Posted on
Thu Jan 05, 2017 11:14 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Solar incidence angle calculation

Cloud cover can be calculated using a lot of the same calculations used in ETo. Of particular importance is the current angle of the sun and the current radiation readings, this will tell you with a decent amount of accuracy how much cloud cover there is because the radiation is mostly constant (variants for flares, etc). The calculator for this is pretty complex but I've written one in Python a while back that I use with my sprinklers to calculate ETo and I'm generally within 1/100th of the "official" reports given by my water department.

I've actually found the lumens being reported by my motion sensors to be hit and miss.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests