Effective Module Tilt and Azimuth Angles
The module orientation is given by the user in the form of nominal tilt and azimuth values. The azimuth angle describes the orientation of the row when viewed from directly above, i.e. projected into the x-y plane of the Site Reference Frame, see Coordinate systems used by SolarFarmer. The tilt angle is defined as the angle between the modules and the x-y plane in the Along-row Reference Frame, again see Coordinate systems used by SolarFarmer, or, in other words, the plane of the modules is formed by rotating the z-y plane in the along-row reference frame by nominal tilt angle, around the y axis. These definition of nominal tilt and azimuth are not quite the correct inputs for the transposition calculation, see Transposition. The transposition calculation is concerned with the translation of the horizontal irradiance values to the plane of the modules. Therefore it needs the total angle between the plane of the modules and the horizontal and the azimuth of the normal of the plane of the modules. These are referred to as the effective tilt and effective azimuth values.
The effective tilt angle is the angle between a normal to the module face, and a normal to a horizontal plane at the same location.
The effective azimuth angle is the angle between the projection of a normal to the module face onto the horizontal plane and a horizontal line pointing north.
Note that it's only the along-row slope that effects the plane of the modules, and the effective tile and azimuth angles. If a system is placed on a North or South facing slope, it is assumed that the nominal tilt value is from the horizontal, and not relative to the slope.
Calculating the Effective Tilt and Azimuth from the Terrain Azimuth and Terrain Slope
To calculate the effective tilt and azimuth from the terrain slope and the azimuth of the terrain slope, we must fist decompose the slope into an along-row slope and a forward slope. Only the along-row slope effects the orientation of the modules. We decompose the slope by considering the gradient, which is a vector quantity. The gradient is the ratio of the change in elevation to the distance traveled horizontally. The gradient is equal to the tangent of the slope angle, as a tangent is the ratio of the opposite to the adjacent in a right angle triangle. $$ \text{total gradient} = \tan \left( \beta_{\text{slope}}\right)$$
For a fixed-tilt site where the along-row direction is the layout azimuth, subtract 90 degrees. $$\text{along-row gradient} = \tan \left( \beta_{\text{slope}}\right) \cos \left( \gamma_{\text{slope}} - \left( \gamma_{l} - 90\right)\right)$$
The along-row slope \(\beta_{a}\) can then be calculated from the along-row gradient $$\beta_{a} = \arctan \left( \text{along-row gradient} \right)$$
In the along-row reference frame the normal vector to the plane of the modules is simply given by the tilt. In cartesian (x,y,z) notations this can be written as: $$\text{module normal in along-row reference frame} = \left( \begin{matrix} \sin(\beta)\\ 0\\ \cos(\beta) \end{matrix}\right)$$
To move from the along-row reference frame to the system azimuth reference frame we rotate back by the along-row slope.
$$\text{module normal in system azimuth reference frame} = \left( \begin{matrix} 1 & 0 & 0\\ 0 & \cos \left(\beta_{a} \right) & \sin \left(\beta_{a} \right)\\ 0 & - \sin \left(\beta_{a} \right) & \cos \left(\beta_{a} \right) \end{matrix} \right) \left( \begin{matrix} \sin(\beta)\\ 0\\ \cos(\beta) \end{matrix}\right)$$ $$\text{module normal in system azimuth reference frame} = \left( \begin{matrix} \sin(\beta)\\ \sin(\beta_{a}) \cos(\beta)\\ \cos(\beta_{a}) \cos(\beta) \end{matrix}\right)$$
The system azimuth reference frame is a horizontal reference frame, so the effective tilt is the same in this frame as in the site reference frame. The tile is the zenith angle of this normal vector so can be found by taking just the z component and equating it to the cosine of the zenith. $$\cos(\beta_{eff}) = \cos(\beta_{a}) \cos(\beta)$$ $$\beta_{eff} = \cos^{-1} \left(\cos(\beta_{a}) \cos(\beta) \right)$$
The azimuth can be found by equating the x and y component to the tangent of the azimuth. Finally we add back in the system azimuth. $$\tan(\gamma_{eff} - \gamma_{l}) = \frac{\sin(\beta_{a}) \cos(\beta)}{-\sin(\beta)}$$ $$\gamma{eff} = \arctan( \frac{\sin(\beta_{a}) \cos(\beta)}{-\sin(\beta)}) + \gamma_{l}$$
Calculationg the Effective Tilt and Azimuth from Rack Edge Vectors
When a rack is positioned on non-level terrain, the 3D module placement algorithm returns vectors along the two edges of each rack (the "rack edge vectors").
Taking the cross product of the rack edge vectors yields a vector normal to the face of the rack. Taking the dot product with a vertical vector gives the effective tilt angle of the rack (\(\beta\)). Taking the inverse tangent of the horizontal x and y components of the vector gives the effective azimuth angle (\(\gamma\)).