Skip to content

Commit

Permalink
feat: add inflation calculator function
Browse files Browse the repository at this point in the history
  • Loading branch information
danielolsen committed Oct 15, 2020
1 parent c575e73 commit d66f26e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion powersimdata/design/investment/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__all__ = ["const", "create_mapping_files", "investment_costs"]
__all__ = ["const", "create_mapping_files", "inflation", "investment_costs"]
24 changes: 24 additions & 0 deletions powersimdata/design/investment/inflation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
inflation_rate_pct = {
2010: 1.5,
2011: 3.0,
2012: 1.7,
2013: 1.5,
2014: 0.8,
2015: 0.7,
2016: 2.1,
2017: 2.1,
2018: 1.9,
2019: 2.3,
2020: 1.3,
}


def calculate_inflation(start_year, end_year):
if start_year not in inflation_rate_pct:
raise ValueError
if (end_year - 1) not in inflation_rate_pct:
raise ValueError
factor = 1
for i in range(start_year, end_year):
factor *= 1 + (inflation_rate_pct[i] / 100)
return factor

0 comments on commit d66f26e

Please sign in to comment.