Consider replacing inverter methods in PVSystem with a single method with a kwarg
See original GitHub issue#886 moved inverter-related functions from pvsystem.py to inverter.py. Methods PVSystem.snlinverter and PVsystem.adrinverter currently wrap inverter.sandia and inverter.adr, respectively, which previously were pvsystem.snlinverter and pvsystem.adrinverter.
Perhaps renaming the functions creates potential for confusion.
It may be an improved API to replace PVSystem.snlinverter, PVSystem.adrinverter and PVSystem.pvwatts_ac with a single method PVSystem.dc_to_ac or similar, with a kwarg model='sandia' for example.
Opening for discussion.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Source code for pvlib.pvsystem
The ``pvsystem`` module contains functions for modeling the output and performance of PV modules and inverters. """ from __future__ import division import ...
Read more >PVLIB_Python Documentation - Read the Docs
pvlib python is a community supported tool that provides a set of functions and classes for simulating the performance.
Read more >How To Use *args and **kwargs in Python 3 - DigitalOcean
In Python, the single-asterisk form of *args can be used as a ... x and y as function parameters, and instead replacing them...
Read more >Python args and kwargs: Demystified
*args and **kwargs allow you to pass multiple arguments or keyword arguments to a function. Consider the following example. This is a simple...
Read more >python - Inheritance best practice : *args, **kwargs or explicitly ...
At the same time I don't think it's correct for all your methods to have a signature of *args , **kwargs . Explicit...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

ModelChain.get_acwouldn’t have that issue, I think, since it can inspectModelChain.results.dcand get what’s needed.For
PVSystem.get_ac(pdc, vdc=None)is similar to what I see done in e.g. scipy.optimize.minimize where many methods are wrapped, and some kwargs are needed for some but not all methods.Method generally looks good to me. A few suggestions:
modelis required, so it should be an arg or akwargwith a non-None default value._validate_per_arraycalls belong outside the if block.if model not in ['sandia', 'pvwatts']with an else block that raises the sameValueErrorI’m ok with that. Would you apply the same logic to the modelchain layer? That would be my preference.
We don’t necessarily need to do that at the same time. Those
ModelChainmethods should be cleaned up but I’m less concerned about them. I don’t think anyone uses them directly and I wouldn’t have concerns about changing them without deprecation.As for actual implementation, one way might be to set the attribute equal to a
partial(self.system.get_ac, model=ac_model).