diff --git a/src/gsy_e/models/area/scm_manager.py b/src/gsy_e/models/area/scm_manager.py index e8962000c..fac361938 100644 --- a/src/gsy_e/models/area/scm_manager.py +++ b/src/gsy_e/models/area/scm_manager.py @@ -213,6 +213,7 @@ class AreaEnergyBills: # pylint: disable=too-many-instance-attributes marketplace_fee: float = 0. assistance_fee: float = 0. fixed_fee: float = 0. + self_consumed_savings: float = 0. _min_community_savings_percent: float = 0. _max_community_savings_percent: float = 0. @@ -278,6 +279,8 @@ def savings(self): # will be negative, and the producer will not have "savings". For a more realistic case # the revenue should be omitted from the calculation of the savings, however this needs # to be discussed. + if gsy_e.constants.SCM_NO_COMMUNITY_SELF_CONSUMPTION: + return self.self_consumed_savings savings_absolute = KPICalculationHelper().saving_absolute( self.base_energy_bill_excl_revenue, self.gsy_energy_bill_excl_revenue) assert savings_absolute > -FLOATING_POINT_TOLERANCE @@ -447,7 +450,8 @@ def calculate_home_energy_bills( home_bill = AreaEnergyBills( marketplace_fee=marketplace_fee, fixed_fee=fixed_fee, assistance_fee=assistance_fee, - gsy_energy_bill=marketplace_fee + fixed_fee + assistance_fee) + gsy_energy_bill=marketplace_fee + fixed_fee + assistance_fee, + self_consumed_savings=home_data.self_consumed_energy_kWh * home_data.market_maker_rate) home_bill.calculate_base_energy_bill( home_data, market_maker_rate_normal_fees, feed_in_tariff) @@ -589,6 +593,7 @@ def community_bills(self) -> Dict: community_bills.marketplace_fee += data.marketplace_fee community_bills.assistance_fee += data.assistance_fee community_bills.fixed_fee += data.fixed_fee + community_bills.self_consumed_savings += data.self_consumed_savings return community_bills.to_dict()