Skip to content

Rethinking pvlib.ivtools #931

Closed
Closed

Description

@cwhanse

When I proposed pvlib.ivtools I had in mind only the use case of fitting single diode models for PV modules. I expect to see PRs soon with a function to fit the Sandia inverter model (to measured efficiency curves), and functions for the Loss Factor Model. These don't meet the narrow scope of the current ivtools. There are likely other model fitting functions that could be of interest to pvlib users.

#708 refactors ivtools to separate functions into modules sde and sdm for single diode equation and model fitting, respectively. In hindsight, ivtools is too generic, since it doesn't communicate what the module does besides something with IV curves.

An alternate home for model fitting functions, including those in ivtools, might be pvanalytics. But the inverter model fitting code doesn't seem natural there, either, since pvanalytics is primarily being designed for analysis of time-series data from PV systems.

Options:

  • keep pvlib.ivtools, and stick fit_inverter_snl (or whatever it's named) into pvlib.pvsystem.
  • add fitting functions to the code module containing the related model function, e.g., put fit_inverter_snl into pvlib.pvsystem or merge Create inverter.py #886 and add fit_inverter_snl there.
  • create a new module with a broader name than ivtools to contain all model fitting functions, divided up into appropriate modules.
  • refer the two PRs to pvanalytics

Other ideas?

Activity

  1. mikofski commented on Mar 9, 2020

    @mikofski
    Member

    -1 on pvanalytics, IMO generating inverter and PV-module parameters should be the job of pvlib

    My personal preference would be to split pvsystem.py out into pvmodules.py and inverters.py, then fit_inverters* and the inverter models would be in inverters.py and ditto for PV-modules. If that's too specific, then PV-modules and inverters could be in components.py which could be a catchall for PV-modules, inverters, trackers, batteries, cabling, xfmrs, etc.

    • IMO pvsystem is too long, Breaking out parts of pvsystem.py? #436
    • pvsystem would still have PVSystem class and some system performance functions like singlediode, max_power_point, etc
    • other component specific functions would be moved to their new homes, such as calcparams*, retrieve_sam, snl_inverter, adrinverter
    *-*- pvsystem/
    |  \
    |   *- pvsystem.py
    |   |
    |   *- components.py
    

    or another way to split them would be pvsystem/performance.py and pvsystem/parameters.py?

  2. cwhanse commented on Mar 10, 2020

    @cwhanse
    MemberAuthor

    I'd favor pvmodule.py and inverter.py over the (IMO) too-generic component.py, parameters.py, etc.

  3. wholmgren commented on Mar 10, 2020

    @wholmgren
    Member

    +/- 0 on moving the fit code to pvanalytics.

    -1 on adding it to existing pvsystem.py.

    +1 on breaking up pvsystem.py and uncertain on moving the fit functions into the relevant new modules.

    -1 on a pvsystem subpackage at this point in time.

  4. added this to the 0.8.0 milestone on Mar 10, 2020
  5. wholmgren commented on Aug 28, 2020

    @wholmgren
    Member

    ok to close this @cwhanse?

  6. cwhanse commented on Aug 28, 2020

    @cwhanse
    MemberAuthor

    yes

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions