gendaymtx - generate an annual Perez sky matrix from a weather tape
gendaymtx [ -v ][ -h ][ -A ][ -d|-s|-n ][ -u ][ -D sunfile [ -M sunmods ]][ -r deg ][ -m N ][ -g r g b ][ -c r g b ][ -o{f|d} ][ -O{0|1} ] [ tape.wea ]
Gendaymtx takes a weather tape as input and produces a matrix of sky patch values using the Perez all-weather model. The weather tape is assumed to be in the simple ASCII format understood by DAYSIM, which contains a short header with the site parameters followed by the month, day, standard time, direct normal and diffuse horizontal irradiance values, one time step per line. Each time step line is used to compute a column in the output matrix, where rows correspond to sky patch positions, starting with 0 for the ground and continuing to 145 for the zenith using the default -m 1 parameter setting.
Increasing the -m parameter yields a higher resolution sky using the Reinhart patch subdivision. For example, setting -m 4 yields a sky with 2305 patches plus one patch for the ground. Each matrix entry is in fact three values, corresponding to red green and blue radiance channels (watts/sr/meter^2). Thus, an hourly weather tape for an entire year would yield 8760x3 (26280) values per output line (row).
The -A option tells gendaymtx to generate a single column corresponding to an average sky computed over all the input time steps, rather than one column per time step.
The -c option may be used to specify a color for the sky. The gray value should equal 1 for proper energy balance. The default sky color is -c 0.960 1.004 1.118 . Similarly, the -g option may be used to specify a ground color. The default value is -g 0.2 0.2 0.2 corresponding to a 20% gray.
If there is a sun in the description, gendaymtx will include its contribution in the four nearest sky patches, distributing energy according to centroid proximity. The -d option may be used to produce a sun-only matrix, with no sky contributions, and the ground patch also set to zero. Alternatively, the -s option may be used to exclude any direct solar component from the output, with the other sky and ground patches unaffected.
The -u option ignores input times when the sun is below the horizon. This is a convenient way to average daylight hours only with the -A option or to ensure that matrix entries correspond to solar positions produced with the -D option, described below.
The -n option may be used if no matrix output is desired at all. This may be used to merely check the input, or in combination with the -D option, below.
The -D option may be used to specify an output file to contain a list of solar positions and intensities corresponding to time steps in the weather tape where the sun has any portion above the horizon. Sun radiance values may be zero if the direct amount is zero on the input. Sun modifiers and names will be indexed by the minute, numbered from midnight, January 1st. If a hyphen (’-’) is given as the argument to -D, then the sun descriptions will be directed to the standard output. This implies the -n option just described. If the -M option is given as well, it will be used to record the modifier names used in the -D output, for convenient input to rcontrib(1) and rfluxmtx(1).
By default, gendaymtx assumes the positive Y-axis points north such that the first sky patch is in the Y-axis direction on the horizon, the second patch is just west of that, and so on spiraling around to the final patch near the zenith. The -r (or -rz) option rotates the sky the specified number of degrees counter-clockwise about the zenith, i.e., west of north. This is in keeping with the effect of passing the output of gensky(1) or gendaylit(1) through xform(1) using a similar transform.
The -of or -od option may be used to specify binary float or double output, respectively. This is much faster to write and to read, and is therefore preferred on systems that support it. (MS Windows is not one of them.) The -O1 option specifies that output should be total solar radiance rather than visible radiance. The -h option prevents the output of the usual header information. Finally, the -v option will enable verbose reporting, which is mostly useful for finding out how many time steps are actually in the weather tape.
Produce an uncolored Tregenza sky matrix without solar direct:
gendaymtx -m 1 -c 1 1 1 -s Detroit.wea > Detroit.mtx |
Produce an hourly, annual Reinhart sky matrix with 2306 patches including solar contributions and send float output to dctimestep(1) to compute a sensor value matrix:
gendaymtx -m 4 -of VancouverBC.wea | dctimestep -if -n 8760 DCoef.mtx > res.dat |
Ian Ashdown wrote most of the code, based on Jean-Jacques Delaunay’s original gendaylit(1) implementation. Greg Ward wrote the final parameter parsing and weather tape conversion.
dctimestep(1), genBSDF(1), gendaylit(1), gensky(1), genskyvec(1), rcollate(1), rcontrib(1), rfluxmtx(1), xform(1)