From 7cf3054e4563303774533bf6224fe3720700d431 Mon Sep 17 00:00:00 2001 From: spyrostz Date: Tue, 30 Jan 2024 14:47:06 +0100 Subject: [PATCH 1/6] GSYE-682: Added one more CoefficientAlgorithm enum for live coefficient streaming. --- gsy_framework/enums.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gsy_framework/enums.py b/gsy_framework/enums.py index b2c445c7..8eb5de60 100644 --- a/gsy_framework/enums.py +++ b/gsy_framework/enums.py @@ -25,6 +25,7 @@ class CoefficientAlgorithm(Enum): STATIC = 1 DYNAMIC = 2 NO_COMMUNITY_SELF_CONSUMPTION = 3 + LIVE_STREAM = 4 class CloudCoverage(Enum): From faff1c76a012cd3f43e7a86dd41d025efb5228e9 Mon Sep 17 00:00:00 2001 From: spyrostz Date: Tue, 30 Jan 2024 17:43:50 +0100 Subject: [PATCH 2/6] GSYE-682: Converted the coefficient_type CDS parameter to optional for backwards compatibility. Added new optional group_settings parameter. --- gsy_framework/schemas.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gsy_framework/schemas.py b/gsy_framework/schemas.py index 9e0f65c5..c1d2402f 100644 --- a/gsy_framework/schemas.py +++ b/gsy_framework/schemas.py @@ -384,8 +384,12 @@ class ApiClientConfigSchema: "type": "string", "enum": ["constant", "dynamic"] }, + "group_settings": { + "type": "string", + "enum": ["constant", "dynamic"] + }, }, - "required": ["start_date", "end_date", "slot_length", "currency", "coefficient_type"] + "required": ["start_date", "end_date", "slot_length", "currency"] }, "grid": {"type": ["object"]} } From d13715bc01cffdcc540d00d41825b38fed5597e7 Mon Sep 17 00:00:00 2001 From: spyrostz Date: Wed, 31 Jan 2024 17:11:14 +0100 Subject: [PATCH 3/6] GSYE-682: Added INTRACOMMUNITY_BASE_RATE_EUR to SCMSettings. Adapted AVRO schema in order to allow starting simulations with the new SCM parameter set. --- gsy_framework/constants_limits.py | 1 + .../avro_schemas/launch_simulation_settings.json | 8 ++++++-- tests/schema/test_settings_validator.py | 12 ++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/gsy_framework/constants_limits.py b/gsy_framework/constants_limits.py index 60ab9810..335e4e2e 100644 --- a/gsy_framework/constants_limits.py +++ b/gsy_framework/constants_limits.py @@ -257,6 +257,7 @@ class BalancingSettings: class SCMSettings: """Default settings for the community manager.""" GRID_FEES_REDUCTION = 0.28 + INTRACOMMUNITY_BASE_RATE_EUR = None MARKET_ALGORITHM = CoefficientAlgorithm.STATIC.value MARKET_ALGORITHM_LIMIT = RangeLimit(1, 3) diff --git a/gsy_framework/schema/avro_schemas/launch_simulation_settings.json b/gsy_framework/schema/avro_schemas/launch_simulation_settings.json index 811f12a3..04924dc8 100644 --- a/gsy_framework/schema/avro_schemas/launch_simulation_settings.json +++ b/gsy_framework/schema/avro_schemas/launch_simulation_settings.json @@ -30,7 +30,11 @@ {"name": "settlement_market_enabled", "type": "boolean"}, {"name": "relative_std_from_forecast_percent", "type": "float"}, {"name": "bid_offer_match_algo", "type": "int"}, - {"name": "scm_coefficient_algorithm", "type": "int"}, - {"name": "type", "type": ["null","int"], "default": "undefined"} + {"name": "type", "type": ["null","int"], "default": "undefined"}, + {"name": "scm_coefficient_algorithm", "type": ["null", "int"], "default": "null"}, + {"name": "scm", "type": [ + "null", + {"type": "map", "values" : ["float", "int", "string"], "default": {}} + ]} ] } diff --git a/tests/schema/test_settings_validator.py b/tests/schema/test_settings_validator.py index a7251d4d..b4f6ab4c 100644 --- a/tests/schema/test_settings_validator.py +++ b/tests/schema/test_settings_validator.py @@ -36,7 +36,12 @@ def setup_method(self): "settlement_market_enabled": False, "relative_std_from_forecast_percent": 10.0, "bid_offer_match_algo": 1, - "scm_coefficient_algorithm": 1, + "scm": { + "name": "DEFAULT_STATIC", + "coefficient_algorithm": 2, + "grid_fees_reduction": 0.01, + "intracommunity_rate_base_eur": 0.5 + }, "type": 0 } @@ -66,7 +71,10 @@ def _assert_all_settings_values(settings: Dict, compare_timedeltas: bool): assert not settings["settlement_market_enabled"] assert settings["relative_std_from_forecast_percent"] == 10.0 assert settings["bid_offer_match_algo"] == 1 - assert settings["scm_coefficient_algorithm"] == 1 + assert settings["scm"]["name"] == "DEFAULT_STATIC" + assert settings["scm"]["coefficient_algorithm"] == 2 + assert isclose(settings["scm"]["grid_fees_reduction"], 0.01, rel_tol=0.0000001) + assert isclose(settings["scm"]["intracommunity_rate_base_eur"], 0.5, rel_tol=0.0000001) assert settings["type"] == 0 def test_simulation_settings_validator_works(self): From c883d4a86d9f311557e8bc733d2a9727fcac51ad Mon Sep 17 00:00:00 2001 From: spyrostz Date: Thu, 1 Feb 2024 11:18:35 +0100 Subject: [PATCH 4/6] GSYE-682: Added null value as an option in the scm settings AVRO schema, in order to support null values for intracommunity_rate_base_eur. --- .../schema/avro_schemas/launch_simulation_settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gsy_framework/schema/avro_schemas/launch_simulation_settings.json b/gsy_framework/schema/avro_schemas/launch_simulation_settings.json index 04924dc8..a7db74ed 100644 --- a/gsy_framework/schema/avro_schemas/launch_simulation_settings.json +++ b/gsy_framework/schema/avro_schemas/launch_simulation_settings.json @@ -34,7 +34,7 @@ {"name": "scm_coefficient_algorithm", "type": ["null", "int"], "default": "null"}, {"name": "scm", "type": [ "null", - {"type": "map", "values" : ["float", "int", "string"], "default": {}} + {"type": "map", "values" : ["float", "int", "string", "null"], "default": {}} ]} ] } From c9067c17453d4c7069020488aa648378c33ee428 Mon Sep 17 00:00:00 2001 From: spyrostz Date: Thu, 1 Feb 2024 17:46:55 +0100 Subject: [PATCH 5/6] GSYE-682: Added earned_from_community to the bills calculation. --- gsy_framework/sim_results/scm/bills.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gsy_framework/sim_results/scm/bills.py b/gsy_framework/sim_results/scm/bills.py index d2d5c362..a3ab74bb 100644 --- a/gsy_framework/sim_results/scm/bills.py +++ b/gsy_framework/sim_results/scm/bills.py @@ -31,6 +31,7 @@ def _empty_bills_dict() -> Dict: "sold_to_grid": 0., "sold_to_community": 0., "earned_from_grid": 0., + "earned_from_community": 0., "home_balance_kWh": 0., "home_balance": 0., "base_energy_bill_excl_revenue": 0., From 4c21e5a2de24a20ea3ec4d7c77bae9a8a805dd54 Mon Sep 17 00:00:00 2001 From: spyrostz Date: Wed, 21 Feb 2024 16:40:00 +0100 Subject: [PATCH 6/6] GSYE-682: Removed used_history from simulation state. --- gsy_framework/schema/avro_schemas/simulation_state.json | 9 +-------- tests/schema/test_data/simulation_state_test_data.json | 4 ---- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/gsy_framework/schema/avro_schemas/simulation_state.json b/gsy_framework/schema/avro_schemas/simulation_state.json index 6db429f2..b39ab695 100644 --- a/gsy_framework/schema/avro_schemas/simulation_state.json +++ b/gsy_framework/schema/avro_schemas/simulation_state.json @@ -278,13 +278,6 @@ "name": "used_storage", "type": "float" }, - { - "name": "used_history", - "type": { - "type": "map", - "values": "string" - } - }, { "name": "charge_history", "type": { @@ -303,7 +296,7 @@ "name": "offered_history", "type": { "type": "map", - "values": "float" + "values": ["string", "float"] } }, { diff --git a/tests/schema/test_data/simulation_state_test_data.json b/tests/schema/test_data/simulation_state_test_data.json index 290f0c08..9e91a5c4 100644 --- a/tests/schema/test_data/simulation_state_test_data.json +++ b/tests/schema/test_data/simulation_state_test_data.json @@ -121,10 +121,6 @@ }, "b5c21c73-e155-4bad-928f-53eb87f7b2dc": { "current_tick": 1440, - "used_history": { - "2023-05-23T22:00": "-", - "2023-05-23T23:00": "-" - }, "used_storage": 0.12, "charge_history": { "2023-05-23T22:00": 10.0,