-
Notifications
You must be signed in to change notification settings - Fork 40
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
Use transformed grid in scaling procedure #261
Conversation
@@ -41,7 +44,7 @@ def _get_renewable_profile(self, resource): | |||
if not bool(self.ct): | |||
return power_output | |||
else: | |||
if "new_plant" in self.ct.keys(): |
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.
So here it is possible that "new_plant" exists in the keys but it is an empty dict?
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.
No it is not possible. If there is a new_plant
key then the value is a list
of dict
enclosing the information of the new plants. The list
can have a single element, i.e., one new plant. Example:
>>> from powersimdata.input.change_table import ChangeTable
>>> from powersimdata.input.grid import Grid
>>> grid = Grid(["USA"])
Reading bus.csv
Reading plant.csv
Reading gencost.csv
Reading branch.csv
Reading dcline.csv
Reading sub.csv
Reading bus2sub.csv
Reading zone.csv
>>> ct = ChangeTable(grid)
>>> new_plant = [{"type": "hydro", "bus_id": 3001001, "Pmin": 60, "Pmax": 85}]
>>> ct.add_plant(new_plant)
>>> ct.ct
{'new_plant': [{'type': 'hydro', 'bus_id': 3001001, 'Pmin': 60, 'Pmax': 85, 'plant_id_neighbor': 13462}]}
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.
Thanks for taking care of this.
scaled_zone = list(ct[resource]["zone_id"].keys()) | ||
scaling_factor_for_zone = list(ct[resource]["zone_id"].values()) | ||
for z, f in zip(scaled_zone, scaling_factor_for_zone): | ||
for z, f in ct[resource]["zone_id"].items(): |
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.
Nice
Purpose
Fix bug discussed in issue (#260)
What is the code doing?
Use the transformed grid in place of the base grid when retrieving the plant id of a given
type
in a givenzone_id
. New plants that are added to the network must be removed from the query since those are not in the base profile that will be scaled.I have also remove 2 variables that were unnecessary in test_transform_profile.py.
Time estimate
30 min. I would say it is the time it takes to understand the issue raised in #260
Test
All tests pass. Also, we are now able to retrieve the solar profile of scenario 462 (see issue #260)