Skip to content

Commit

Permalink
GSYE-724: Add hours of delay to scm settings
Browse files Browse the repository at this point in the history
  • Loading branch information
BigTava committed May 6, 2024
1 parent 9afb662 commit 04e7279
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
1 change: 1 addition & 0 deletions gsy_framework/constants_limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ class SCMSettings:
INTRACOMMUNITY_BASE_RATE_EUR = None
MARKET_ALGORITHM = CoefficientAlgorithm.STATIC.value
MARKET_ALGORITHM_LIMIT = RangeLimit(1, 3)
HOURS_OF_DELAY = 72


def is_no_community_self_consumption() -> bool:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
{"name": "bid_offer_match_algo", "type": "int"},
{"name": "type", "type": ["null","int"], "default": "undefined"},
{"name": "scm_coefficient_algorithm", "type": ["null", "int"], "default": "null"},
{"name": "scm_cn_hours_of_delay", "type": ["null", "int"],"default": "null"},
{"name": "scm", "type": [
"null",
{"type": "map", "values" : ["float", "int", "string", "null"], "default": {}}
Expand Down
30 changes: 18 additions & 12 deletions tests/schema/test_settings_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ def setup_method(self):
"name": "DEFAULT_STATIC",
"coefficient_algorithm": 2,
"grid_fees_reduction": 0.01,
"intracommunity_rate_base_eur": 0.5
"intracommunity_rate_base_eur": 0.5,
"hours_of_delay": 72,
},
"type": 0
"type": 0,
}

@staticmethod
Expand Down Expand Up @@ -69,6 +70,7 @@ def _assert_all_settings_values(settings: Dict, compare_timedeltas: bool):
assert settings["bid_offer_match_algo"] == 1
assert settings["scm"]["name"] == "DEFAULT_STATIC"
assert settings["scm"]["coefficient_algorithm"] == 2
assert settings["scm"]["hours_of_delay"] == 72
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
Expand All @@ -81,16 +83,20 @@ def test_simulation_settings_validator_works(self):
settings = reader.read(decoder)
self._assert_all_settings_values(settings, False)

@pytest.mark.parametrize("settings_key, settings_value", [
("type", "COLLABORATION"),
("settlement_market_enabled", 0),
("scm_coefficient_algorithm", 1.3),
("bid_offer_match_algo", "payasclear"),
("relative_std_from_forecast_percent", "ten percent"),
("currency", "EUR"),
("external_connection_enabled", "yes"),
("grid_fee_type", "dynamic"),
])
@pytest.mark.parametrize(
"settings_key, settings_value",
[
("type", "COLLABORATION"),
("settlement_market_enabled", 0),
("scm_coefficient_algorithm", 1.3),
("scm_cn_hours_of_delay", 72.1),
("bid_offer_match_algo", "payasclear"),
("relative_std_from_forecast_percent", "ten percent"),
("currency", "EUR"),
("external_connection_enabled", "yes"),
("grid_fee_type", "dynamic"),
],
)
def test_simulation_settings_validator_rejects_incorrect_values(
self, settings_key: str, settings_value: Any):
incorrect_data = deepcopy(self._data)
Expand Down

0 comments on commit 04e7279

Please sign in to comment.