Skip to content

Conversation

@daniel-thom
Copy link
Collaborator

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.py for example uses. I fixed the OpenDSS reader but nothing else.

raise NotImplementedError(
"Build function must be implemented by derived classes"
)
"""Optional function to perform post-init construction after an element
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note this change. It is a potential point of disagreement.

self.model[node].nominal_voltage = new_value

node_model = None
for model_type in (Node, Load, PowerSource, Capacitor):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a better pattern than this. This was just to make some tests pass.

np.random.seed(0)
# Loop over the objects
for elt in self.model.models:
# TODO: Tarek, can we specify a type?
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note this one

# 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):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

import numpy as np


from ditto.store import ElementNotFoundError
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that most of the changes in this file are due to removals of indentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant