How to calculate the houses shadow position given altitude and azimuth of the sun

geometry

I would like to automatically withdraw my awning, if the shadow of the house (which is perfectly N-S oriented) has advanced far enough so that the patio is shadowed anyway:

Scetch of house, awning and sun

I thought this would be a simple 2D problem. I waited until the shadow has reached point X in the drawing. At that time,the altitude of the sun was at 54.4⁰. I configured my home automation to withdraw the awning if the altitude is < 54.4⁰ and it was fine.

Except, that after a few days it wasn't anymore. Currently, the altitude is reached at about 13:30, which is shortly after the sun is in the cenith (daylight saving time).

My assumption was clearly wrong and I need more than just the altitude. But I can't figure out how to calculate that.

Best Answer

In the image shown, the part of the house that casts the shadow is the bottom of the roof. (If the roof was steeper than the line from the bottom of the roof to ground where the shadow must be for the patio to be shadowed, then it would be the apex.) Replace the house with a simple wall, and consider the situation from above.

The shadow-casting wall is aligned east-west, height $h$, and we need the shadow to extend north by $L$. Let $\theta$ be the sun elevation ($0°$ for horizon, $90°$ for zenith, and $\varphi$ sun azimuth ($0°$ for North, $90°$ for East, $180°$ for South, and $270°$ for West).

If the sun was due South, then the shadow would be directly Northwards, and we'd have the right triangle as illustrated in OP's image. The shadow length $\ell$ would be the side nearest to $\theta$, the wall height $h$ the side opposite to $\theta$, so $\tan\theta = h / \ell$, i.e. $\ell = h / \tan\theta$. Note that this only occurs when $\varphi = 180°$; the shadow length measured in North-South direction is given by $$\ell = \bigr(-\cos\varphi\bigr) \frac{h}{\tan\theta}$$ (with negative values of $\ell$ meaning the shadow is towards South, not North).

Therefore, the rule for $\ell \ge L$ is $$\bigr(-\cos\varphi\bigr) \frac{h}{\tan\theta} \ge L$$ or, using the ratio of shadow length North-Southwards to wall height, $L/h$, $$\frac{\cos\varphi}{\tan\theta} \le -\frac{L}{h}$$

Related Question