Skip to content

bifacial.utils.vf_ground_sky_2d interprets max_rows asymmetrically #1867

Description

@kandersolar

Describe the bug
vf_ground_sky_2d considers one fewer sky wedge on the right side of the central wedge than it does on the left side.

To Reproduce
I added a line print(next_edge) after here:

np.clip(next_edge, a_min=0., a_max=None, out=next_edge)

Then I ran _ = vf_ground_sky_2d(surface_tilt=0, gcr=0.5, x=0.5, pitch=1, height=1, max_rows=3) and got the printed text: [[[0.01598559 0.04556841 0.18086881 0.48507125 0.18086881 0.04556841]]].

Each value in that output describes the VF of a visible sky wedge. The inputs describe a symmetrical system, so the VFs should be symmetrical too, and they are, except one of them is missing... 0.485 for the wedge directly overhead, with three wedges to the left but only two to the right.

Expected behavior
I want the number of sky wedges considered in each direction to be equal.

Maybe this is a fencepost problem, and really what I want is effectively a max_wedges parameter instead of max_rows?

Activity

  1. pasquierjb commented on Oct 17, 2023

    @pasquierjb
    Contributor

    k goes from -max_rows to max_rows+1 so the symmetry is for x=0 which is indeed problematic if you intergrate betwen 0 and 1 for a small max_rows. However as max_rows is set to be high enough to neglect the horizon VF, not sure it will change a lot the results.

    download (7)

  2. Sar-thak-3 commented on Jan 7, 2024

    @Sar-thak-3

    Hi @kandersolar, is this issue still open? I would love to contribute to this issue!

  3. Chirag3841 commented on Dec 12, 2025

    @Chirag3841
    Contributor

    @kandersolar I want to contribute to this issue if anyone had not taken that .

  4. AdamRJensen commented on Dec 12, 2025

    @AdamRJensen
    Member

    @kandersolar I want to contribute to this issue if anyone had not taken that .

    Hi 👋 @Chirag3841 Thanks for your interest in contributing to pvlib. Please note that making meaningful code contributions to pvlib requires some familiarity with photovoltaics or solar irradiance. If you have this background, we would be happy to help you along.

  5. added this to the v0.15.2 milestone on May 6, 2026
  6. kandersolar commented on May 8, 2026

    @kandersolar
    MemberAuthor

    really what I want is effectively a max_wedges parameter instead of max_rows?

    This hints at the real problem, which is that there are several repeating units in this model, not all of which are aligned:

    • PV rows
    • Ground segments of length pitch
    • Air gaps between adjacent PV rows

    Unfortunately, the model was defined such that ground segments are not centered on PV rows, i.e. ground segments go from 0 to pitch relative to the point underneath a PV row. This problem could have been avoided by defining the ground surface to go from -pitch/2 to pitch/2 instead (although that approach may have its own problems).

    Consider the following diagram:

    Image

    The parameter description for max_rows says:

    max_rows : int, default 10
    Maximum number of rows to consider on either side of the current
    row. [unitless]

    For this x=0.8, the "current row" is Row 0. Therefore, with the current implementation, for max_rows=1, we must consider only rows -1 to 1, which means the appropriate VF is the sum of wedges -1 and 0.

    I think it would be nicer if max_rows was defined here relative to the "current ground segment" (instead of "current row"), which would have the following behavior:

    • max_rows=1: consider only Rows 0 and 1, so VF is given by wedge 0.
    • max_rows=2: consider Rows -1 to 2, so VF is given by the sum of wedges -1, 0, and 1.

    Any thoughts?

  7. cwhanse commented on May 8, 2026

    @cwhanse
    Member

    relative to the "current ground segment" (instead of "current row")

    +1 to this. But I would exclude the rows that define the current ground segment, so that max_rows=1 is the sum of wedges -1, 0, 1.

  8. added a commit that references this issue on Jun 1, 2026
  9. modified the milestones: v0.15.2, v0.15.3 on Jun 9, 2026
  10. modified the milestones: v0.15.3, v0.16.0 on Aug 5, 2026
  11. kandersolar commented on Sep 23, 2026

    @kandersolar
    MemberAuthor

    Closed by #2740

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions