Skip to content
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

Feature/gsye 650 heatpump fixes #493

Merged
merged 12 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gsy_framework/schema/avro_schemas/simulation_raw_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@
{"name": "energy_consumption_kWh", "type": "float"},
{"name": "max_energy_demand_kWh", "type": "float"},
{"name": "min_energy_demand_kWh", "type": "float"},
{"name": "total_traded_energy_kWh", "type": "float"},
{"name": "cop", "type": "float"},
{"name": "condenser_temp_C", "type": "float"},
{"name": "heat_demand_J", "type": "float"},
Expand Down
7 changes: 7 additions & 0 deletions gsy_framework/schema/avro_schemas/simulation_state.json
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,13 @@
"type": "map",
"values": "float"
}
},
{
"name": "total_traded_energy_kWh",
"type": {
"type": "map",
"values": "float"
}
}
]
}
Expand Down
10 changes: 7 additions & 3 deletions gsy_framework/sim_results/kpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from gsy_framework.sim_results import (is_buffer_node_type, is_load_node_type,
is_producer_node_type,
is_prosumer_node_type)
is_prosumer_node_type, is_heatpump_node_type)
from gsy_framework.sim_results.kpi_calculation_helper import (
KPICalculationHelper)
from gsy_framework.sim_results.results_abc import ResultsBaseClass
Expand Down Expand Up @@ -53,7 +53,7 @@
if is_producer_node_type(child):
if_not_in_list_append(self.producer_list, child["uuid"])
if_not_in_list_append(self.areas_to_trace_list, child["parent_uuid"])
elif is_load_node_type(child):
elif is_load_node_type(child) or is_heatpump_node_type(child):
if_not_in_list_append(self.consumer_list, child["uuid"])
if_not_in_list_append(self.areas_to_trace_list, child["parent_uuid"])
elif is_prosumer_node_type(child):
Expand All @@ -68,6 +68,9 @@
child_stats = core_stats.get(child["uuid"], {})
if is_load_node_type(child):
self.total_energy_demanded_wh += child_stats.get("total_energy_demanded_wh", 0)
if is_heatpump_node_type(child):
self.total_energy_demanded_wh += (

Check warning on line 72 in gsy_framework/sim_results/kpi.py

View check run for this annotation

Codecov / codecov/patch

gsy_framework/sim_results/kpi.py#L72

Added line #L72 was not covered by tests
child_stats.get("total_traded_energy_kWh", 0) * 1000.0)
Comment on lines 69 to +73
Copy link
Member

Choose a reason for hiding this comment

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

grrrrr, not pretty, but this is how it is with heritage. :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, this is the unfortunate thing with inheritance and with mixing units as well. At least from now on, we should probably stick to kWh no matter what FE or customers say.

if child["children"]:
self._accumulate_total_energy_demanded(child, core_stats)

Expand Down Expand Up @@ -154,6 +157,7 @@
def update_area_kpi(self, area_dict: Dict, core_stats: Dict):
"""Update kpi after every market cycle"""
self.total_energy_demanded_wh = 0

self._accumulate_total_energy_demanded(area_dict, core_stats)
self._accumulate_energy_trace(core_stats)

Expand Down Expand Up @@ -202,7 +206,7 @@
for child in area_dict["children"]:
if is_producer_node_type(child):
self.producer_ess_set.add(child["uuid"])
elif is_load_node_type(child):
elif is_load_node_type(child) or is_heatpump_node_type(child):
self.consumer_ess_set.add(child["uuid"])
elif is_prosumer_node_type(child):
self.producer_ess_set.add(child["uuid"])
Expand Down
4 changes: 4 additions & 0 deletions tests/schema/test_data/simulation_state_test_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@
"energy_consumption_kWh": {
"2023-05-23T22:00": 0.04,
"2023-05-23T23:00": 0.6
},
"total_traded_energy_kWh": {
"2023-05-23T22:00": 0.04,
"2023-05-23T23:00": 0.6
}
},
"ffe6fad2-b480-4729-be69-c8bb6dc594ff": {
Expand Down
Loading