diff --git a/gsy_framework/sim_results/pv_roi.py b/gsy_framework/sim_results/pv_roi.py new file mode 100644 index 00000000..4437a02b --- /dev/null +++ b/gsy_framework/sim_results/pv_roi.py @@ -0,0 +1,31 @@ +from typing import Dict + + +class PVROI: + """ + Class that calculates the Return on Investment (ROI), annual cash flow, + and payback period for a PV asset based on the simulation results. + """ + + def __init__(self): + pass + + def process_area(self, area): + print("area", area) + for area in area["children"]: + if area["type"] == "PVStrategy": + print("hey", area) + elif hasattr(area, "children"): + self.process_area(area) + + def summary_25_years(self): + """ + Returns payback period, balance, yearly revenue and profit over a 25-year period. + """ + summary = { + "payback_years": 0, + "final_balance": 0, + "yearly_revenue": 0, + "year_to_profit": [{2025: 0}], + } + return summary diff --git a/tests/test_sim_results/constants.py b/tests/test_sim_results/constants.py index 89880993..e0621be8 100644 --- a/tests/test_sim_results/constants.py +++ b/tests/test_sim_results/constants.py @@ -4,6 +4,40 @@ current_market_slot = datetime(2023, 1, 23, 15) +TEST_AREA_SETUP_PV_ONLY = { + "name": "Grid", + "children": [ + { + "name": "House 2", + "children": [ + { + "name": "H2 PV", + "uuid": "83c25853-4bdc-486d-9549-68178d6b7546", + "strategy": { + "type": "PVStrategy", + "kwargs": { + "panel_count": 1, + "capacity_kW": 1, + "fit_to_limit": True, + "update_interval": 60, + "initial_selling_rate": 80, + "final_selling_rate": 0, + "energy_rate_decrease_per_update": None, + "use_market_maker_rate": False, + "price_installation_per_kW": 100, + }, + }, + "display_type": "PVStrategy", + }, + ], + "uuid": "a8ff7ec0-3d15-4139-8801-ccea3cc3dd3f", + "display_type": "Area", + }, + ], + "uuid": "5a53cc1d-121b-4ce1-8c09-ac8a689843b6", + "display_type": "Area", +} + TEST_AREA_RESULTS_DICT = { "name": "Grid", "uuid": "70b818d1-491f-49ca-8566-1334eec06f15", diff --git a/tests/test_sim_results/test_pv_roi.py b/tests/test_sim_results/test_pv_roi.py new file mode 100644 index 00000000..a5a6e727 --- /dev/null +++ b/tests/test_sim_results/test_pv_roi.py @@ -0,0 +1,32 @@ +from math import isclose + +from gsy_framework.constants_limits import ( + FLOATING_POINT_TOLERANCE, +) +from gsy_framework.sim_results.pv_roi import ( + PVROI, +) +from tests.test_sim_results.constants import ( + TEST_AREA_SETUP_PV_ONLY, +) + + +class TestPVROI: + # pylint: disable=attribute-defined-outside-init + + def setup_method(self): + self.area_setup = TEST_AREA_SETUP_PV_ONLY + + def test_carbon_emissions_from_gsy_trade_profile_calculates_correctly( + self, + ): + # Given + pv_roi = PVROI() + + # When + pv_roi = pv_roi.process_area(area=self.area_setup) + + # Then + # assert isclose( + # carbon_emissions["carbon_generated_g"], 417.004, abs_tol=FLOATING_POINT_TOLERANCE + # )