Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions gsy_framework/sim_results/pv_roi.py
Original file line number Diff line number Diff line change
@@ -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
34 changes: 34 additions & 0 deletions tests/test_sim_results/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
32 changes: 32 additions & 0 deletions tests/test_sim_results/test_pv_roi.py
Original file line number Diff line number Diff line change
@@ -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
# )
Loading