Debian Codegraph @

texmf-dist/doc/latex/sunpath/sunpath.docpart.tex

raw
1 \section{Documentation}
2
3 \subsection{Context and Terms}
4 The position of the sun from perspective of an observer is defined by two parameters:
5
6 \begin{itemize}
7 \item the azimuth $\Phi$, which tells the observer, how far (in degree) he must turn around from the North direction,
8 \item the altitude $\theta$, which tells the observer, how height (in degree) about the horizon he must look to see the sun.
9 \end{itemize}
10 The azimuth can take a value in the interval $[0,360)$.
11 The altitude can take a value in the interval $[0,90]$, whereas 0 is the horizon, 90 is the zenith.
12 We do not care so much about how far is the sun, so we normalize this distance to 1.
13
14
15 The figure~\ref{fig:hz-coordinate} shows these parameter.
16 The coordinate system, which takes the position of the observer as the centre,
17 and the observer's local horizon as the fundamental plane,
18 is called horizontal coordinate system.\footnote{dt.: topozentrisches Koordinatensystem}
19
20 \begin{figure}[H]
21 \centering
22 \includegraphics[scale=0.75]{horizontal-coordinate.pdf}
23 \caption{Horizontal coordinate system}
24 \label{fig:hz-coordinate}
25 \end{figure}
26
27 In this package, the cardinal points have specifics values of azimuth as following:
28
29 \begin{tabular}{c c c c}
30 North & East & South & West \\
31 0° & 90° & 180° & 270°
32 \end{tabular}
33
34
35 The projection of the sun on the horizon plane is a point, which can be defined by two parameters:
36 \begin{itemize}
37 \item the angle $\Phi$,
38 \item the distance $r = \cos(\theta)$ from the centre to the sun.
39 \end{itemize}
40
41 Figure~\ref{fig:sun-projection} shows the projection of the sun on the horizontal plane.
42 If we track the position of sun on the horizontal plane changes from time to time, we will get a curve.
43 This curve is called the sun path.
44 A chart which shows position of the sun from time to time is called a sun path chart.
45 Of course there are many type of sun path chart.
46 This package provides tools to plot sun path on the horizontal plane.
47
48 \begin{figure}[H]
49 \centering
50 \begin{tikzpicture}[spradius=3]
51 \spcrosshair
52 \spaltitudecircle{{0}}
53 \spgeodirection[0pt]
54 \path[draw=red,fill=red](sunpath cs:azi=110,alt=66) circle[radius=2pt] ;
55 \end{tikzpicture}
56 \caption{Projection of the sun on the horizon plane}
57 \label{fig:sun-projection}
58 \end{figure}
59
60
61 \subsection{Draw a Sun path chart}
62
63 Figure~\ref{fig:sun-projection} is a very rudimentary sun path chart.
64 There is neither scalar, nor time on the chart.
65 A more usable Sun path chart may look like one in the figure~\ref{fig:full-sun-path-chart}.
66 In this section we will create this chart.
67
68
69 \begin{figure}[H]
70 \centering
71 \begin{tikzpicture}
72 \spcrosshair
73 \spaltitudecircle{{0,10,...,80,85}}
74 \spazimuthline{{0,10,...,360}}{85}{70}
75 \spazimuthline{{0,5,...,360}}{80}{0}
76
77 \spazimuthtick
78
79 \spgeodirection
80 \spaltitudelabel{{10,20,...,80,85}}
81 \spazimuthlabel{{0,15,...,350}}
82
83 \path[draw=red,fill=red](sunpath cs:azi=110,alt=66) circle[radius=2pt] node[below] {{9:30}};
84 \end{tikzpicture}
85 \caption{A Sun path chart}
86 \label{fig:full-sun-path-chart}
87 \end{figure}
88
89 \subsubsection{Outlines}
90
91 User has to place \verb:\usepackage{sunpath}: in the preamble part of the document.
92
93 The chart is a \TikZ-picture, so we need a \texttt{tikzpicture}-environment.
94 We can also customize the distance from the centre of the chart to the horizon line by setup the option \texttt{spradius}.
95 By default it is 5.5 in PGF xy coordinate.
96 In this example we make it a little bigger:
97
98 \marginpar{\texttt{spradius}}
99 \begin{verbatim}
100 \begin{tikzpicture}[spradius=6]
101 \end{tikzpicture}
102 \end{verbatim}
103
104 We also need the crosshair, the horizon line --in this type of sun path chart it is a circle--,
105 the fours geographic direction.
106 This can be done by adding more commands into the \texttt{tikzpicture}
107
108 \begin{verbatim}
109 \begin{tikzpicture}[spradius=6]
110 \spcrosshair
111 \spaltitudecircle{{0}}
112 \spgeodirection
113 \end{tikzpicture}
114 \end{verbatim}
115
116 \marginpar{\texttt{drawcrosshair\\ drawgeodirection\\ drawaltitudecircle}}
117 \begin{tikzpicture}[spradius=6]
118 \spcrosshair
119 \spaltitudecircle{{0}}
120 \spgeodirection
121 \end{tikzpicture}
122
123
124 Man has to pay attention to the double curry brackets in the command \texttt{drawaltitudecircle}.
125 The outer brackets delimit the argument of the command.
126 The argument of the command is a valid \TikZ-range, which is used in a \verb:\foreach: command,
127 so it has be placed in between a pair of curry bracket.
128 That is the inner brackets.
129
130
131 \subsubsection{Scalar and labels}
132
133
134 As the name of the commando says, we can also draw more than the horizon line by adding some values of altitude in the range of the argument of the command \verb|\spaltitudecircle|.
135 For example \verb:\spaltitudecircle{{0,10,...,80,85}}: draws 10 circles of altitude.
136
137 \marginpar{\texttt{drawaltitudecircle}}
138 \begin{verbatim}
139 \begin{tikzpicture}[spradius=6]
140 \spcrosshair
141 \spaltitudecircle{{0,10,...,80,85}}
142 \spgeodirection
143 \end{tikzpicture}
144 \end{verbatim}
145
146 \begin{tikzpicture}[spradius=6]
147 \spcrosshair
148 \spaltitudecircle{{0,10,...,80,85}}
149 \spgeodirection
150 \end{tikzpicture}
151
152
153 We can use the command \verb:\drawazumuthline{r}{h}{l}: to draw azimuth lines in range \verb:r:,
154 from the higher altitude \verb:h: to the lower altitude \verb:l:.
155
156 For example
157
158 \begin{itemize}
159 \item \verb:\spazimuthline{{0,10,...,360}}{85}{70}: draws every 10° azimuth from the 85° altitude to to 70° altitude.
160 \item \verb:\spazimuthline{{0,5,...,360}}{80}{0}: draws every 5° azimuth from the 80° altitude to to 0° altitude.
161 \end{itemize}
162
163 \begin{verbatim}
164 \begin{tikzpicture}[spradius=6]
165 \spcrosshair
166 \spaltitudecircle{{0,10,...,80,85}}
167 \spazimuthline{{0,10,...,360}}{85}{70}
168 \spazimuthline{{0,5,...,360}}{80}{0}
169
170 \spgeodirection
171 \end{tikzpicture}
172 \end{verbatim}
173
174 \marginpar{\texttt{drawazimuthline}}
175 \begin{tikzpicture}[spradius=6]
176 \spcrosshair
177 \spaltitudecircle{{0,10,...,80,85}}
178 \spazimuthline{{0,10,...,360}}{85}{70}
179 \spazimuthline{{0,5,...,360}}{80}{0}
180
181 \spgeodirection
182 \end{tikzpicture}
183
184 To draw azimuth ticks outside the horizon line, we can use
185 \verb:\spazimuthtick:.
186 This command expects for now no argument.
187
188 \begin{verbatim}
189 \begin{tikzpicture}[spradius=6]
190 \spcrosshair
191 \spaltitudecircle{{0,10,...,80,85}}
192 \spazimuthline{{0,10,...,360}}{85}{70}
193 \spazimuthline{{0,5,...,360}}{80}{0}
194 \spazimuthtick
195
196 \spgeodirection
197 \end{tikzpicture}
198 \end{verbatim}
199
200 \marginpar{\texttt{drawazimuthtick}}
201 \begin{tikzpicture}[spradius=6]
202 \spcrosshair
203 \spaltitudecircle{{0,10,...,80,85}}
204 \spazimuthline{{0,10,...,360}}{85}{70}
205 \spazimuthline{{0,5,...,360}}{80}{0}
206 \spazimuthtick
207
208 \spgeodirection
209 \end{tikzpicture}
210
211
212 To draw labels of azimuth lines and altitude circles in the chart, we can use the commands
213
214 \verb:\spaltitudelabel{r}: and
215
216 \verb:\spazimuthlabel{r}:.
217
218 \begin{tikzpicture}[spradius=6]
219 \spcrosshair
220 \spaltitudecircle{{0,10,...,80,85}}
221 \spazimuthline{{0,10,...,360}}{85}{70}
222 \spazimuthline{{0,5,...,360}}{80}{0}
223 \spazimuthtick
224
225 \spaltitudelabel{{10,20,...,80,85}}
226 \spazimuthlabel{{0,15,...,350}}
227 \spgeodirection
228 \end{tikzpicture}
229
230 That it's, now we have a nice chart, on which we can draw positions of the sun from time to time.
231
232 \subsubsection{Position of the sun}
233
234 We can easily plot the position of the sun in the chart with the coordinate \texttt{sunpath},
235 if the azimuth and the altitude are given.
236 For example, to plot the position of the sun with 150° Azimuth and 22° Altitude,
237 we just use the \texttt{path} command as following:
238
239 \verb|\path[fill=red,draw=red] (sunpath cs:azi=150,alt=22);|
240
241 The result would be
242
243 \begin{verbatim}
244 % ...
245 \path[fill=red,draw=red] (sunpath cs:azi=150,alt=35) circle[radius=2pt];
246 \spaltitudelabel{{10,20,...,80,85}}[160]
247 % ...
248 \end{verbatim}
249
250 \marginpar{\texttt{sunpath cs}}
251 \begin{tikzpicture}[spradius=6]
252 \spcrosshair
253 \spaltitudecircle{{0,10,...,80,85}}
254 \spazimuthline{{0,10,...,360}}{85}{70}
255 \spazimuthline{{0,5,...,360}}{80}{0}
256 \spazimuthtick
257
258 \path[fill=red,draw=red] (sunpath cs:azi=150,alt=35) circle[radius=2pt];
259
260 \spaltitudelabel{{10,20,...,80,85}}[160]
261 \spazimuthlabel{{0,15,...,350}}
262 \spgeodirection
263 \end{tikzpicture}
264
265 The command \verb:\spaltitudelabel: can also take an optional argument to set altitude label on other azimuth.
266 This can be useful if the labels cover distract important points on chart.
267 In this chart it is set to be 160°. So one can easily read the azimuth of the sun on the chart.
268
269 We can also connect the position of the sun to a path, for example with the positions given in the following table
270
271 {\ttfamily
272 \begin{tabular}{c c c}
273 Time & Azimuth & Altitude \\
274 07:44 & 98.968673 & -0.208672 \\
275 08:00 & 102.009695 & 2.035492 \\
276 10:00 & 126.513583 & 19.499874 \\
277 12:00 & 156.854847 & 31.593335 \\
278 14:00 & 192.292832 & 33.425294 \\
279 16:00 & 224.708002 & 24.034984 \\
280 18:00 & 250.626597 & 7.619801 \\
281 18:53 & 260.810553 & -0.244637 \\
282 \end{tabular}
283 }
284
285 we can get a sun path like this:
286
287 \begin{tikzpicture}[spradius=6]
288 \tikzset{
289 sunpath curve/.style={draw,fill=red},
290 sunpath point/.style={radius=2pt,draw=red},
291 sunpath node/.style={below,inner sep=0.5pt,outer sep=4.5pt,fill=white}
292 }
293 \spcrosshair
294 \spaltitudecircle{{0,10,...,80,85}}
295 \spazimuthline{{0,10,...,360}}{85}{70}
296 \spazimuthline{{0,5,...,360}}{80}{0}
297 \spazimuthtick
298
299 \path[sunpath curve]
300 (sunpath cs:azi=98.968673,alt=-0.208672) circle[sunpath point] node[sunpath node]{ { 07:44 } }
301 --(sunpath cs:azi=102.009695,alt=2.035492) circle[sunpath point] node[sunpath node]{ { 08:00 } }
302 --(sunpath cs:azi=126.513583,alt=19.499874) circle[sunpath point] node[sunpath node]{ { 10:00 } }
303 --(sunpath cs:azi=156.854847,alt=31.593335) circle[sunpath point] node[sunpath node]{ { 12:00 } }
304 --(sunpath cs:azi=192.292832,alt=33.425294) circle[sunpath point] node[sunpath node]{ { 14:00 } }
305 --(sunpath cs:azi=224.708002,alt=24.034984) circle[sunpath point] node[sunpath node]{ { 16:00 } }
306 --(sunpath cs:azi=250.626597,alt=7.619801) circle[sunpath point] node[sunpath node]{ { 18:00 } }
307 --(sunpath cs:azi=260.810553,alt=-0.244637) circle[sunpath point] node[sunpath node]{ { 18:53 } }
308 ;
309
310 \spaltitudelabel{{10,20,...,80,85}}
311 \spazimuthlabel{{0,15,...,350}}
312 \spgeodirection
313 \end{tikzpicture}
314
315 But this chart is not nice.
316 If the data is machine readable, we can generate all stuffs of the chart automatically.
317 This chart below is generated from the table above.
318 Just use your favourite programming language to process sun data.
319
320 \begin{tikzpicture}[spradius=6]
321 \tikzset{
322 sun path curve/.style={draw=red!20,thick},
323 sun point/.style={radius=2pt,draw=red,fill=red},
324 sun label/.style={below,fill=white,outer sep=4pt,text=red},
325 }
326 \spcrosshair
327 \spaltitudecircle{{0,10,...,80,85}}
328 \spazimuthline{{0,10,...,360}}{85}{70}
329 \spazimuthline{{0,5,...,360}}{80}{0}
330 \spazimuthtick
331
332 \coordinate (P0) at (sunpath cs:azi=98.968673,alt=-0.208672);
333 \coordinate (P1) at (sunpath cs:azi=102.009695,alt=2.035492);
334 \coordinate (P2) at (sunpath cs:azi=126.513583,alt=19.499874);
335 \coordinate (P3) at (sunpath cs:azi=156.854847,alt=31.593335);
336 \coordinate (P4) at (sunpath cs:azi=192.292832,alt=33.425294);
337 \coordinate (P5) at (sunpath cs:azi=224.708002,alt=24.034984);
338 \coordinate (P6) at (sunpath cs:azi=250.626597,alt=7.619801);
339 \coordinate (P7) at (sunpath cs:azi=260.810553,alt=-0.244637);
340 \path[sun point] (P0) circle;
341 \path[sun point] (P1) circle;
342 \path[sun point] (P2) circle;
343 \path[sun point] (P3) circle;
344 \path[sun point] (P4) circle;
345 \path[sun point] (P5) circle;
346 \path[sun point] (P6) circle;
347 \path[sun point] (P7) circle;
348 \node[sun label,anchor=270-98.968673] at (P0) {07:44};
349 \node[sun label,anchor=270-102.009695] at (P1) {08:00};
350 \node[sun label,anchor=270-126.513583] at (P2) {10:00};
351 \node[sun label,anchor=270-156.854847] at (P3) {12:00};
352 \node[sun label,anchor=270-192.292832] at (P4) {14:00};
353 \node[sun label,anchor=270-224.708002] at (P5) {16:00};
354 \node[sun label,anchor=270-250.626597] at (P6) {18:00};
355 \node[sun label,anchor=270-260.810553] at (P7) {18:53};
356 \path[sun path curve] (P0) to [curve through={ (P1) .. (P2) .. (P3) .. (P4) .. (P5) .. (P6) }] (P7) ;
357
358 \spaltitudelabel{{10,20,...,80,85}}[170]
359 \spazimuthlabel{{0,15,...,350}}
360 \spgeodirection
361 \end{tikzpicture}
362
363 \vfill\newpage
364 The part, which makes the chart nicer, is there:
365
366 \begin{verbatim}
367 %...
368 \coordinate (P0) at (sunpath cs:azi=98.968673,alt=-0.208672);
369 \coordinate (P1) at (sunpath cs:azi=102.009695,alt=2.035492);
370 \coordinate (P2) at (sunpath cs:azi=126.513583,alt=19.499874);
371 \coordinate (P3) at (sunpath cs:azi=156.854847,alt=31.593335);
372 \coordinate (P4) at (sunpath cs:azi=192.292832,alt=33.425294);
373 \coordinate (P5) at (sunpath cs:azi=224.708002,alt=24.034984);
374 \coordinate (P6) at (sunpath cs:azi=250.626597,alt=7.619801);
375 \coordinate (P7) at (sunpath cs:azi=260.810553,alt=-0.244637);
376 \path[sun point] (P0) circle;
377 \path[sun point] (P1) circle;
378 \path[sun point] (P2) circle;
379 \path[sun point] (P3) circle;
380 \path[sun point] (P4) circle;
381 \path[sun point] (P5) circle;
382 \path[sun point] (P6) circle;
383 \path[sun point] (P7) circle;
384 \node[sun label,anchor=270-98.968673] at (P0) {07:44};
385 \node[sun label,anchor=270-102.009695] at (P1) {08:00};
386 \node[sun label,anchor=270-126.513583] at (P2) {10:00};
387 \node[sun label,anchor=270-156.854847] at (P3) {12:00};
388 \node[sun label,anchor=270-192.292832] at (P4) {14:00};
389 \node[sun label,anchor=270-224.708002] at (P5) {16:00};
390 \node[sun label,anchor=270-250.626597] at (P6) {18:00};
391 \node[sun label,anchor=270-260.810553] at (P7) {18:53};
392 \path[sun path curve] (P0) to [curve through={
393 (P1) .. (P2) .. (P3) .. (P4) .. (P5) .. (P6)
394 }]
395 (P7) ;
396 %...
397 \end{verbatim}
398
399 To set the altitude scale (and also the altitude lines) equidistance, just use the option \verb|altitude mapping=equidistance|.
400 The chart above with same data looks like the chart below with this option.
401
402 \marginpar{\texttt{altitude mapping}} \texttt{ = equidistance}
403
404 \begin{tikzpicture}[spradius=6,altitude mapping=equidistance]
405 \tikzset{
406 sun path curve/.style={draw=red!20,thick},
407 sun point/.style={radius=2pt,draw=red,fill=red},
408 sun label/.style={below,fill=white,outer sep=4pt,text=red},
409 }
410 \spcrosshair
411 \spaltitudecircle{{0,10,...,80,85}}
412 \spazimuthline{{0,10,...,360}}{85}{70}
413 \spazimuthline{{0,5,...,360}}{80}{0}
414 \spazimuthtick
415
416 \coordinate (P0) at (sunpath cs:azi=98.968673,alt=-0.208672);
417 \coordinate (P1) at (sunpath cs:azi=102.009695,alt=2.035492);
418 \coordinate (P2) at (sunpath cs:azi=126.513583,alt=19.499874);
419 \coordinate (P3) at (sunpath cs:azi=156.854847,alt=31.593335);
420 \coordinate (P4) at (sunpath cs:azi=192.292832,alt=33.425294);
421 \coordinate (P5) at (sunpath cs:azi=224.708002,alt=24.034984);
422 \coordinate (P6) at (sunpath cs:azi=250.626597,alt=7.619801);
423 \coordinate (P7) at (sunpath cs:azi=260.810553,alt=-0.244637);
424 \path[sun point] (P0) circle;
425 \path[sun point] (P1) circle;
426 \path[sun point] (P2) circle;
427 \path[sun point] (P3) circle;
428 \path[sun point] (P4) circle;
429 \path[sun point] (P5) circle;
430 \path[sun point] (P6) circle;
431 \path[sun point] (P7) circle;
432 \node[sun label,anchor=270-98.968673] at (P0) {07:44};
433 \node[sun label,anchor=270-102.009695] at (P1) {08:00};
434 \node[sun label,anchor=270-126.513583] at (P2) {10:00};
435 \node[sun label,anchor=270-156.854847] at (P3) {12:00};
436 \node[sun label,anchor=270-192.292832] at (P4) {14:00};
437 \node[sun label,anchor=270-224.708002] at (P5) {16:00};
438 \node[sun label,anchor=270-250.626597] at (P6) {18:00};
439 \node[sun label,anchor=270-260.810553] at (P7) {18:53};
440 \path[sun path curve] (P0) to [curve through={ (P1) .. (P2) .. (P3) .. (P4) .. (P5) .. (P6) }] (P7) ;
441
442 \spaltitudelabel{{10,20,...,80,85}}[170]
443 \spazimuthlabel{{0,15,...,350}}
444 \spgeodirection
445 \end{tikzpicture}
446
447