Refactor element containers in Store#356
Open
daniel-thom wants to merge 5 commits intoNatLabRockies:masterfrom
Open
Refactor element containers in Store#356daniel-thom wants to merge 5 commits intoNatLabRockies:masterfrom
daniel-thom wants to merge 5 commits intoNatLabRockies:masterfrom
Conversation
266cdef to
3684223
Compare
daniel-thom
commented
Nov 12, 2020
| raise NotImplementedError( | ||
| "Build function must be implemented by derived classes" | ||
| ) | ||
| """Optional function to perform post-init construction after an element |
Collaborator
Author
There was a problem hiding this comment.
Note this change. It is a potential point of disagreement.
daniel-thom
commented
Nov 12, 2020
| self.model[node].nominal_voltage = new_value | ||
|
|
||
| node_model = None | ||
| for model_type in (Node, Load, PowerSource, Capacitor): |
Collaborator
Author
There was a problem hiding this comment.
We need a better pattern than this. This was just to make some tests pass.
daniel-thom
commented
Nov 12, 2020
| np.random.seed(0) | ||
| # Loop over the objects | ||
| for elt in self.model.models: | ||
| # TODO: Tarek, can we specify a type? |
daniel-thom
commented
Nov 12, 2020
| # Get the from node | ||
| if hasattr(obj, "from_element") and obj.from_element is not None: | ||
| node_from_object = self.model[obj.from_element] | ||
| for obj in self.model.iter_elements(Line, lambda x: x.nominal_voltage is None): |
Collaborator
Author
There was a problem hiding this comment.
@tarekelgindy Let me know what you think of the filter function. You may or may not find it more readable. It removes some of the heavily-nested blocks.
daniel-thom
commented
Nov 12, 2020
| import numpy as np | ||
|
|
||
|
|
||
| from ditto.store import ElementNotFoundError |
Collaborator
Author
There was a problem hiding this comment.
Note that most of the changes in this file are due to removals of indentation.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is an intermediate PR that should not be merged to master. Many more changes are required. I want to make sure you agree with the first set of changes before proceeding.
Take a look at
tests/test_store.pyfor example uses. I fixed the OpenDSS reader but nothing else.