Skip to content

Allow arbitrary IAM function in pvlib.iam.marion_diffuse, and possibly improve horizon integral computation. #1980

Closed

Description

@markcampanelli

Is your feature request related to a problem? Please describe.
I am working on an application using pvlib.iam.marion_diffuse, and I would like to inject my own IAM function as a parameter to this pvlib.iam.marion_diffuse.

Describe the solution you'd like
I would like to define the common interface for the existing IAM function choices fo pvlib.iam.marion_diffuse, then allow any function meeting this interface (or Protocol, in Python speak) to be passable to pvlib.iam.marion_diffuse.

Describe alternatives you've considered
Do this on my own and not try to port it back to pvlib-python.

Additional context
If my understanding is correct, there is also a potential simplification to the Marion integral for the horizon component, which for models like Perez is considered to be concentrated in the 2D horizon ring.

Activity

  1. kandersolar commented on Feb 24, 2024

    @kandersolar
    Member

    Note that marion_diffuse is a simple wrapper around marion_integrate, which takes an arbitrary function f(aoi) and integrates it across a region. So it is already possible to use custom IAM functions, although it's somewhat cumbersome. Some brief discussion of this idea is in the original PR: #984 (comment)

    I think it would be a straightforward modification to allow marion_diffuse to take functions as well as the current model names.

  2. markcampanelli commented on Feb 25, 2024

    @markcampanelli
    ContributorAuthor

    @kandersolar Thanks for the background. I see in the history that your first inclination was apparently to make marion_diffuse simply take any callable IAM function :). Given the way pvlib-python tends to prefer ease-of-use over extensibility, I think relying on the lower level marion_integrate is probably sufficient for this repo. I'm going to close this.

  3. markcampanelli commented on Apr 15, 2024

    @markcampanelli
    ContributorAuthor

    For posterity (using pvlib 0.10.4), here is a computational comparison of the three correction factors from the Marion model using the physical setting in pvlib.iam.marion_diffuse vs. using pvlib.iam.marion_integrate with the "custom" IAM model derived from a PCHIP interpolation to IEC 61853-2 data (see graph).

    pvlib.iam.marion_diffuse using physical model
    {'ground': 0.7998463278034974,
    'horizon': 0.8975832800966072,
    'sky': 0.9587871231479588}

    pvlib.iam.marion_integrate using interpolated data IEC 61853-2:
    {'ground': 0.8312793473238048,
    'horizon': 0.9199299978256542,
    'sky': 0.9691309027924638}

    Thanks again @kandersolar for suggesting the workaround :).

    image

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions