diff --git a/gsy_framework/constants_limits.py b/gsy_framework/constants_limits.py index c5527c3c..f3c7d27b 100644 --- a/gsy_framework/constants_limits.py +++ b/gsy_framework/constants_limits.py @@ -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: diff --git a/gsy_framework/enums.py b/gsy_framework/enums.py index eed54bae..b2c445c7 100644 --- a/gsy_framework/enums.py +++ b/gsy_framework/enums.py @@ -24,6 +24,7 @@ class CoefficientAlgorithm(Enum): STATIC = 1 DYNAMIC = 2 + NO_COMMUNITY_SELF_CONSUMPTION = 3 class CloudCoverage(Enum): diff --git a/gsy_framework/schema/avro_schemas/simulation_raw_data.json b/gsy_framework/schema/avro_schemas/simulation_raw_data.json index b11571e8..41893f8b 100644 --- a/gsy_framework/schema/avro_schemas/simulation_raw_data.json +++ b/gsy_framework/schema/avro_schemas/simulation_raw_data.json @@ -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", diff --git a/gsy_framework/schema/avro_schemas/simulation_state.json b/gsy_framework/schema/avro_schemas/simulation_state.json index 4c238fd5..95ab3678 100644 --- a/gsy_framework/schema/avro_schemas/simulation_state.json +++ b/gsy_framework/schema/avro_schemas/simulation_state.json @@ -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", @@ -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": { diff --git a/gsy_framework/sim_results/__init__.py b/gsy_framework/sim_results/__init__.py index 72230a5f..930ee5b5 100644 --- a/gsy_framework/sim_results/__init__.py +++ b/gsy_framework/sim_results/__init__.py @@ -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): diff --git a/gsy_framework/sim_results/device_statistics.py b/gsy_framework/sim_results/device_statistics.py index 3af3d630..6c31d8f6 100644 --- a/gsy_framework/sim_results/device_statistics.py +++ b/gsy_framework/sim_results/device_statistics.py @@ -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) diff --git a/gsy_framework/utils.py b/gsy_framework/utils.py index 68b55da9..2413465b 100644 --- a/gsy_framework/utils.py +++ b/gsy_framework/utils.py @@ -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"]) diff --git a/gsy_framework/validators/heat_pump_validator.py b/gsy_framework/validators/heat_pump_validator.py index 168dd23c..f4793a46 100644 --- a/gsy_framework/validators/heat_pump_validator.py +++ b/gsy_framework/validators/heat_pump_validator.py @@ -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": [ diff --git a/tests/schema/test_data/simulation_state_test_data.json b/tests/schema/test_data/simulation_state_test_data.json index e90629db..cb8225b7 100644 --- a/tests/schema/test_data/simulation_state_test_data.json +++ b/tests/schema/test_data/simulation_state_test_data.json @@ -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, diff --git a/tests/test_assets_info.py b/tests/test_assets_info.py index c0178d4e..36908f7b 100644 --- a/tests/test_assets_info.py +++ b/tests/test_assets_info.py @@ -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": @@ -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