From 646df401e7e5a6fd8850266fcb74f7c64b2e079f Mon Sep 17 00:00:00 2001 From: spyrostz Date: Tue, 28 Nov 2023 17:19:46 +0100 Subject: [PATCH 1/3] GSYYE-663: Added NO_COMMUNITY_SELF_CONSUMPTION option to the SCM MARKET_ALGORITHM constant. --- gsy_framework/constants_limits.py | 8 +++++++- gsy_framework/enums.py | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gsy_framework/constants_limits.py b/gsy_framework/constants_limits.py index c5527c3c..7e97cd60 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) + + @classmethod + @property + def is_no_community_self_consumption(cls): + """Check whether the SCM mode is set to no-community-self-consumption.""" + return cls.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): From 72e2ef3f4d0eb4a1a43f9b5b05de5fd9255ccd61 Mon Sep 17 00:00:00 2001 From: spyrostz Date: Tue, 28 Nov 2023 17:26:40 +0100 Subject: [PATCH 2/3] GSYE-663: Converted class property to classmethod in order to avoid pylint warnings in gsy-e. --- gsy_framework/constants_limits.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gsy_framework/constants_limits.py b/gsy_framework/constants_limits.py index 7e97cd60..17ed8e03 100644 --- a/gsy_framework/constants_limits.py +++ b/gsy_framework/constants_limits.py @@ -261,8 +261,7 @@ class SCMSettings: MARKET_ALGORITHM_LIMIT = RangeLimit(1, 3) @classmethod - @property - def is_no_community_self_consumption(cls): + def is_no_community_self_consumption(cls) -> bool: """Check whether the SCM mode is set to no-community-self-consumption.""" return cls.MARKET_ALGORITHM == CoefficientAlgorithm.NO_COMMUNITY_SELF_CONSUMPTION.value From 801950115be7fea16dc1200a169f732e86108998 Mon Sep 17 00:00:00 2001 From: spyrostz Date: Wed, 13 Dec 2023 11:05:14 +0200 Subject: [PATCH 3/3] GSYE-663: Moved the check of the no community self consumption to the module level, since this being part of the class prevented correct serialization. --- gsy_framework/constants_limits.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gsy_framework/constants_limits.py b/gsy_framework/constants_limits.py index 17ed8e03..f3c7d27b 100644 --- a/gsy_framework/constants_limits.py +++ b/gsy_framework/constants_limits.py @@ -260,10 +260,11 @@ class SCMSettings: MARKET_ALGORITHM = CoefficientAlgorithm.STATIC.value MARKET_ALGORITHM_LIMIT = RangeLimit(1, 3) - @classmethod - def is_no_community_self_consumption(cls) -> bool: - """Check whether the SCM mode is set to no-community-self-consumption.""" - return cls.MARKET_ALGORITHM == CoefficientAlgorithm.NO_COMMUNITY_SELF_CONSUMPTION.value + +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: