-
Notifications
You must be signed in to change notification settings - Fork 1.1k
pre-configured ModelChains #1013
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Replacing the multiple model name attributes with a single dict has some appeal... |
I guess the two ideas could also be combined: # modelchain.py
pvwatts_config = dict(
dc_model='pvwatts', ac_model='pvwatts', losses_model='pvwatts',
transposition_model='perez', aoi_model='physical'
)
PVWatts = functools.partial(ModelChain, **pvwatts_config)
# user code
my_model_chain = ModelChain(my_location, my_system, **pvwatts_config)
# or
my_model_chain = PVWatts(my_location, my_system) |
Any comments on preferred approaches from folks that use |
I haven't used
I've wondered about this too. NREL/rdtools#173 added the ability to normalize against any user-supplied expected energy timeseries, which I think fits into a broader sentiment of "rdtools isn't in the PV modeling business". I don't see much of a benefit to rdtools interacting with a ModelChain instance and calling its methods instead of having the user do it and pass in the result instead. Maybe @mdeceglie has thoughts? |
To me the pre-configured dict alone is sufficient and a simple solution from a maintainer standpoint, but how would the dict be offered to users for use in their code? The simplest entrypoint for the user may very well be the PVWatts partial class. Though I worry the standalone PVWatts is redundant and just creates extra entries into the chain to maintain, especially given the complications described in the SO. There are some possible benefits to using the pre-configured dict with ModelChain such as maintaining compatibility where it is already being used and setting a precedent for other pre-configurations to follow the same format without needed other partial Classes for each one. Would there be interest in adding a parameter to ModelChain like 'model_strategy' in the vein of orientation_strategy, that when set configures the pvwatts_config dict on the backend? So the user would call ModelChain(my_location, my_system, model_strategy='pvwatts')? |
Thanks for the feedback. I started trying to implement the
It would just be accessible as
Interesting idea. I like the simplicity of the interface. I think it might be difficult to handle and to document how that keyword argument interacts with the other keyword arguments, but maybe doable. I have the same concern with |
I don't use the model chains, but I prefer the subclass approach in #1022. |
Tossing out another idea, the factory pattern, perhaps used with @ncroft-b4's |
Factory pattern is a good idea. We might want a different method for each predefined chain because they won't necessarily have the same parameters. For example, a PVWatts chain would not expose transposition to the user (documentation says to use Perez) but another chain might leave that to the user as a kwarg. I could see similar factories for (I fixed the link in @kanderso-nrel's post) |
PVWatts and SAPM factories implemented in #1022 for discussion. |
I think I slightly prefer the There might be a simpler name for the method. Maybe instead of |
Good points @ncroft-b4. |
In #1022, I like having the |
Is your feature request related to a problem? Please describe.
ModelChain
has a lot of options and can be challenging to configure. This also makes it difficult to implement reference implementations of workflows.Describe the solution you'd like
Create wrappers for pre-configured ModelChains. For example, a
PVWatts
version ofModelChain
might look like:This SO post discusses some subtleties with using
partial
with classes, so the actual implementation might require the helper function in that post.Describe alternatives you've considered
We could subclass ModelChain but that seems like overkill for this. Inheritance leads to brittle code, in my experience, so I prefer to avoid it if possible.
We could supply dicts of parameters e.g.
Any other ideas?
The text was updated successfully, but these errors were encountered: