Determine sun azimuth and elevation for shading a window throughout the year I was wondering how I could get the sun's azimuth and elevation values to shade a particular window with a roller shutter.

At first I thought azimuth is good enough; of course, it wasn't, as I found out in practice.
While there are calculators to find a and e for a specific location at a certain date, I lack the maths to figure out when the sun will hit a western window.

The window faces 270 deg, I know how far the eaves stick out, and the top and bottom edges of the window (and of course location).

I get the idea the maths will be complicated... however, (it won't matter much) as I want to program this into a controller to operate the shutter.

Any hints appreciated.
You can use a package such as the pyephem package for python. It can calculate the position of any astronomical object.

However for the sun since it moves along the ecliptic, roughly at a uniform rate, you can approximate the position by doing coordinate transformations. The sun's longitude moves by 365.24/360 degrees a day from 0 at the vernal equinox and has an ecliptic latitude of 90 degrees. This can be converted into equatorial coordinates (right ascension and declension), and then, given the hour, the alt and az positions can be found. The formulae can all be found on https://en.wikipedia.org/wiki/Celestial_coordinate_system