-
Notifications
You must be signed in to change notification settings - Fork 1.1k
refactor ModelChain with methods instead of classes #194
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
Conversation
I added modelchain options for pvwatts dc/ac/losses models, aoi models, and spectral models. I've done a lot of small tests of the code and I think it's fairly robust, but I've not extensively tested it under real world conditions. It will be at least 4 weeks before I can push the code to its breaking point. Would you rather have only modestly tested modelchain code merged and released this week or better tested code in 4 weeks? I prefer to merge and release now and let you do the real world testing and file bug reports. |
I suspect you'll get the best feedback if you release now, and I think we On Wed, Jul 27, 2016 at 10:30 AM, Will Holmgren notifications@github.com
|
Thanks for your input, Jessica. Closes #143. |
I proposed refactoring ModelChain into a base class, a SAPM class, and a SingleDiode class in #179. This likely is a bad idea. It severely limits the flexibility of future ModelChains by promoting a single model choice, the DC power model, to the level of a class choice. It is also likely to make user code unnecessarily complicated.
Here, I propose a new way to extend ModelChain that may be more flexible, more powerful, and easier to use. The strategy is to assign predefined or user-defined functions to standard method names. For example, ModelChain.dc_model will be set to ModelChain.sapm or ModelChain.singlediode. This is basically a controlled version of "monkey patching", which is generally regarded as a bad thing in Python. I'm not sure what the problems would be, though.
Here's a gist with a notebook that demonstrates the usage:
https://gist.github.com/wholmgren/3fabacd3003c2a549b420b5e79f55e95
Some highlights: