-
Notifications
You must be signed in to change notification settings - Fork 1.1k
refactor ModelChain inverter methods to use PVSystem.get_ac #1150
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
8eb7ed5
deprecate methods
wholmgren 2736f8b
remove new but unreleased methods
wholmgren 457689a
refactor modelchain inverter methods for get_ac
wholmgren ec4dba7
update whats new
wholmgren 90a268d
update api.rst
wholmgren ab4ab6e
remove tests for methods that no longer exist
wholmgren 3e5aaa4
fix get_ac with sandia tests
wholmgren b603a29
fix get_ac with sandia tests
wholmgren 02492e4
clean up pvsystem imports
wholmgren 84ce209
add test of infer_ac_model
wholmgren b40c6ac
no v in deprecated args
wholmgren e7f4be7
fix pull number....
wholmgren 7b8bb4e
remove _infer_ac_model_multi
wholmgren File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need both
infer_ac_model
andinfer_ac_model_multi
? Maybe not.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative is something like the nested if statements of
PVSystem.get_ac
. We need some way of raising aValueError
ifnum_arrays > 1
and the parameters are not consistent with pvwatts or sandia (essentially what we have now inModelChain
). Equivalently, for now, we could raise aValueError
ifnum_arrays > 1
and the parameters are consistent with adr (essentially what we have now inPVSystem.get_ac
). This behavior is tested intest_ModelChain_invalid_inverter_params_arrays
. I have a slight preference to leave it alone, but I'll change it if you prefer it more likePVSystem.get_ac
.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. It might make more sense to do the validation in
PVSystem.get_ac
so that it catches both ModelChain and PVSystem users.The
_infer
methods are only used when the inverter model isn't named, and the parameters for either_multi
inverter model are the same as for the single MPPT version. That's why I don't see a need to keep both_infer
methods since the ModelChain methods are aligned with the three model names rather than with the fiveinverter
functions.Assuming you agree with either of these points, I'm OK deferring to later work.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more trade off here... The validation in the infer method helps avoid errors in PVSystem.get_ac during run_model. Traditionally ModelChain.run_model is nearly guaranteed to run if ModelChain can infer all methods at construction. Of course, as you point out, it only works if the user does not pass ac_model.
I'm generally -1 on input validation within pvlib so I'm ok with changing this in the long run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raise ValueError in
_infer_ac_model
when parameters indicate 'adr' and num_arrays > 1. Otherwiseget_ac
should be fine.