Skip to content

Implementing a "plug-in model" architecture #373

Open

Description

@markcampanelli

Issues #227 and #306, in addition to the existing Sandia and DeSoto device performance models, suggest that pvlib could benefit from a "plug-in model architecture" that would establish common API requirements that anyone need follow to plug in their performance models into the greater modeling chain.

I might be able to design something around the device performance models, but I wouldn't be able to do this quickly/easily for the inverter models, etc. I worry that this will be like herding cats, however!

Activity

  1. wholmgren commented on Sep 13, 2017

    @wholmgren
    Member

    Sounds great, but I don't know what this means in practice. Can you be more specific about what this would look like? Would it be code or documentation?

    As of now, contributors write a function that implements their model and conforms to the variable and style rules. Hopefully they (and the reviewers) try to make the API similar to existing functions with similar purposes. Then we have a handful of functions and methods that provide unified interfaces to different kinds of models (e.g. get_solarposition, total_irrad, get_clearsky). Finally, ModelChain provides a unified interface to multiple modeling steps. I am reluctant to ask contributors, particularly new contributors, to go through those library-wide integration steps, though.

    Note that ModelChain provides support for user-defined models: http://pvlib-python.readthedocs.io/en/latest/modelchain.html#User-defined-models

  2. wholmgren commented on Jul 26, 2019

    @wholmgren
    Member

    This blog post on entrypoints made me think of your plug in idea. Not sure what this would look like in practice either.

    https://blog.danallan.com/posts/2019-07-24-use-entrypoints-more/

  3. markcampanelli commented on Jul 30, 2019

    @markcampanelli
    ContributorAuthor

    Python 3.7's dynamic module attributes offers a fairly lightweight plugin discovery mechanism: https://realpython.com/python37-new-features/#customization-of-module-attributes

    I'm trying to absorb the above entrypoints approach to make an informed comparison.

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