Skip to content

Commit

Permalink
Merge branch 'master' into feature/GSYE-650
Browse files Browse the repository at this point in the history
  • Loading branch information
spyrostz authored Dec 19, 2023
2 parents 7a447e9 + ae92142 commit 53cd00c
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 7 deletions.
8 changes: 7 additions & 1 deletion gsy_framework/constants_limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,13 @@ class SCMSettings:
"""Default settings for the community manager."""
GRID_FEES_REDUCTION = 0.28
MARKET_ALGORITHM = CoefficientAlgorithm.STATIC.value
MARKET_ALGORITHM_LIMIT = RangeLimit(1, 2)
MARKET_ALGORITHM_LIMIT = RangeLimit(1, 3)


def is_no_community_self_consumption() -> bool:
"""Check whether the SCM mode is set to no-community-self-consumption."""
return (ConstSettings.SCMSettings.MARKET_ALGORITHM ==
CoefficientAlgorithm.NO_COMMUNITY_SELF_CONSUMPTION.value)


class GlobalConfig:
Expand Down
1 change: 1 addition & 0 deletions gsy_framework/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class CoefficientAlgorithm(Enum):

STATIC = 1
DYNAMIC = 2
NO_COMMUNITY_SELF_CONSUMPTION = 3


class CloudCoverage(Enum):
Expand Down
4 changes: 4 additions & 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,10 @@
{"name": "energy_consumption_kWh", "type": "float"},
{"name": "max_energy_demand_kWh", "type": "float"},
{"name": "min_energy_demand_kWh", "type": "float"},
{"name": "cop", "type": "float"},
{"name": "condenser_temp_C", "type": "float"},
{"name": "heat_demand_J", "type": "float"},
{"name": "unmatched_demand_kWh", "type": "float"},
{"name": "market_fee", "type": "float"},
{
"name": "bids",
Expand Down
66 changes: 66 additions & 0 deletions gsy_framework/schema/avro_schemas/simulation_state.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,44 @@
}
]
},
{
"name": "SmartMeterAreaStats",
"type": "record",
"fields": [
{
"name": "current_tick",
"type": [
"null",
"int"
]
},
{
"name": "energy_production_forecast_kWh",
"type": {
"type": "map",
"values": "float"
}
},
{
"name": "available_energy_kWh",
"type": {
"type": "map",
"values": "float"
}
},
{
"name": "desired_energy_Wh",
"type": {
"type": "map",
"values": "float"
}
},
{
"name": "total_energy_demanded_Wh",
"type": "float"
}
]
},
{
"name": "StorageAreaStats",
"type": "record",
Expand Down Expand Up @@ -376,6 +414,34 @@
"values": "float"
}
},
{
"name": "cop",
"type": {
"type": "map",
"values": "float"
}
},
{
"name": "condenser_temp_C",
"type": {
"type": "map",
"values": "float"
}
},
{
"name": "heat_demand_J",
"type": {
"type": "map",
"values": "float"
}
},
{
"name": "unmatched_demand_kWh",
"type": {
"type": "map",
"values": "float"
}
},
{
"name": "energy_consumption_kWh",
"type": {
Expand Down
2 changes: 1 addition & 1 deletion gsy_framework/sim_results/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,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
2 changes: 1 addition & 1 deletion gsy_framework/sim_results/device_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def _gather_device_statistics(cls, area_dict: Dict, subdict: Dict,
for child in area_dict["children"]:
if child["name"] not in subdict.keys():
subdict.update({child["name"]: {}})
if child["children"] == [] and core_stats != {}:
if not child["children"] and core_stats != {}:
cls._get_device_statistics(
child, subdict[child["name"]], flat_result_dict,
core_stats, current_market_slot)
Expand Down
3 changes: 2 additions & 1 deletion gsy_framework/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,8 @@ class HomeRepresentationUtils:

@staticmethod
def _is_home(representation):
home_devices = ["PV", "Storage", "Load", "MarketMaker"]
home_devices = ["PV", "Storage", "Load", "MarketMaker", "HeatPump", "WindTurbine",
"SmartMeter"]
return all("type" in c and c["type"] in home_devices
for c in representation["children"])

Expand Down
3 changes: 2 additions & 1 deletion gsy_framework/validators/heat_pump_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ def validate_rate(cls, **kwargs):
initial_buying_rate = kwargs["initial_buying_rate"]
preferred_buying_rate = kwargs["preferred_buying_rate"]
final_buying_rate = (
GlobalConfig.MARKET_MAKER_RATE if kwargs.get("use_market_maker_rate")
GlobalConfig.MARKET_MAKER_RATE if kwargs.get("use_market_maker_rate") is True
else kwargs.get("final_buying_rate"))

validate_range_limit(
initial_buying_rate, preferred_buying_rate, final_buying_rate,
{"misconfiguration": [
Expand Down
16 changes: 16 additions & 0 deletions tests/schema/test_data/simulation_state_test_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,22 @@
"2023-05-23T22:00": 0.0,
"2023-05-23T23:00": 0.0
},
"cop": {
"2023-05-23T22:00": 4.0,
"2023-05-23T23:00": 6.0
},
"condenser_temp_C": {
"2023-05-23T22:00": 5.0,
"2023-05-23T23:00": 6.0
},
"heat_demand_J": {
"2023-05-23T22:00": 7.0,
"2023-05-23T23:00": 8.0
},
"unmatched_demand_kWh": {
"2023-05-23T22:00": 4.0,
"2023-05-23T23:00": 6.0
},
"temp_increase_K": {},
"max_energy_demand_kWh": {
"2023-05-23T22:00": 4.276815903856106,
Expand Down
22 changes: 20 additions & 2 deletions tests/test_assets_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,24 @@ def test_update_from_repr(self):
"type": "Storage",
"battery_capacity_kWh": 20
},
{
"type": "Area",
"children":
[
{
"type": "HeatPump"
},
]
},
{
"type": "Area",
"children":
[
{
"type": "SmartMeter"
},
]
},
{
"type": "Area",
"children":
Expand Down Expand Up @@ -121,8 +139,8 @@ def test_update_from_repr(self):
"total_energy_capacity_kwh": 45,
"number_of_power_plant_type": 2,
"max_power_plant_power_kw": 45,
"number_of_house_type": 2,
"avg_assets_per_house": 3
"number_of_house_type": 4,
"avg_assets_per_house": 2
}
actual_res = {key: self.assets_info.raw_results[key] for key in expected_res}
assert expected_res == actual_res

0 comments on commit 53cd00c

Please sign in to comment.