pvlib / twoaxistracking

twoaxistracking is a python package for simulating two-axis tracking solar collectors, particularly self-shading.
http://twoaxistracking.rtfd.io/
BSD 3-Clause "New" or "Revised" License
7 stars 3 forks source link

Add maximum shading elevation to `two_axis_shading_fraction` #5

Closed AdamRJensen closed 2 years ago

AdamRJensen commented 2 years ago

The code currently executes relatively slow, hence it is of great interest to find methods to speed up the calculations.

One reviewer has proposed to:

... to calculate a maximum solar elevation beyond which any self-shading is impossible for a given array geometry. That would allow shading calculations to be skipped for a large portion of daylight hours.

An initial bootstrap implementation of this showed a 23 % decrease in computational time for the investigated field layout and aperture geometry. Hence, some improvements is certainly achievable, though it varies significantly with the specific field layout and aperture shape.

In order to implement this concept, an analytical method for determining the maximum shading elevation should be developed. The allowable inputs to the method are the field layout and the aperture geometry. Potentially the maximum shading elevation can be calculated in the generate_field_layout function and be passed to the two_axis_shading_fraction function.

The implementation of this concept in the two_axis_shading_fraction function would simply involve adding an extra optional input argument (max_elevation) and adding the following code to the start of the function:

if solar_elevation >= max_elevation:
    return 0
soma2000-lang commented 2 years ago

@AdamRJensen can you give me some insights to work on this issue.

AdamRJensen commented 2 years ago

Hi @soma2000-lang. I already have a PR practically ready for this issue. Sorry for not making that visible.

soma2000-lang commented 2 years ago

Ok no problem