Skip to content

Commit

Permalink
GSSYE-650: Added total_traded_energy_Wh to the KPI calculation for He…
Browse files Browse the repository at this point in the history
…atpump and Virtual Heatpump strategies. Added total_traded_energy_kWh to the AVRO schema.
  • Loading branch information
spyrostz committed Nov 21, 2023
1 parent bee4d27 commit 2e7be23
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
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": "market_fee", "type": "float"},
{
"name": "bids",
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 @@ -382,6 +382,13 @@
"type": "map",
"values": "float"
}
},
{
"name": "total_traded_energy_kWh",
"type": {
"type": "map",
"values": "float"
}
}
]
}
Expand Down
3 changes: 2 additions & 1 deletion gsy_framework/sim_results/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"""
from gsy_framework.utils import area_name_from_area_or_ma_name


def is_load_node_type(area):
"""Check if the given asset is a load."""
return area["type"] in ["LoadHoursStrategy", "DefinedLoadStrategy",
Expand All @@ -27,7 +28,7 @@ def is_load_node_type(area):

def is_heatpump_node_type(area):
"""Check if the given asset is a heat pump."""
return area["type"] in ["HeatPumpStrategy"]
return area["type"] in ["HeatPumpStrategy", "VirtualHeatpumpStrategy"]


def is_bulk_power_producer(area):
Expand Down
9 changes: 7 additions & 2 deletions gsy_framework/sim_results/kpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def accumulate_devices(self, area_dict: Dict):
if is_producer_node_type(child) or is_heatpump_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 @@ -72,6 +72,9 @@ def _accumulate_total_energy_demanded(self, area_dict: Dict, core_stats: Dict):
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 += (
child_stats.get("total_traded_energy_kWh", 0) * 1000.0)
if child["children"]:
self._accumulate_total_energy_demanded(child, core_stats)

Expand Down Expand Up @@ -205,10 +208,12 @@ def _populate_consumer_producer_sets(self, area_dict: Dict):
Args:
area_dict: It contains the respective area's core info
"""
if "DH" in area_dict["name"]:
return
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

0 comments on commit 2e7be23

Please sign in to comment.