# -*- coding: utf-8 -*-
"""Module to collect useful functions for economic calculation.
This file is part of project oemof (github.com/oemof/oemof). It's copyrighted
by the contributors recorded in the version control history of the file,
available from its original location oemof/oemof/tools/economics.py
SPDX-License-Identifier: GPL-3.0-or-later
"""
[docs]def annuity(capex, n, wacc):
"""Calculate the annuity.
annuity = capex * (wacc * (1 + wacc) ** n) / ((1 + wacc) ** n - 1)
Parameters
----------
capex : float
Capital expenditure (NPV of investment)
n : int
Number of years that the investment is used (economic lifetime)
wacc : float
Weighted average cost of capital
Returns
-------
float : annuity
"""
return capex * (wacc * (1 + wacc) ** n) / ((1 + wacc) ** n - 1)