|
1
|
|
|
# -*- coding: utf-8 -*- |
|
2
|
|
|
|
|
3
|
|
|
"""Module to collect useful functions for economic calculation. |
|
4
|
|
|
|
|
5
|
|
|
This file is part of project oemof (github.com/oemof/oemof). It's copyrighted |
|
6
|
|
|
by the contributors recorded in the version control history of the file, |
|
7
|
|
|
available from its original location oemof/oemof/tools/economics.py |
|
8
|
|
|
|
|
9
|
|
|
SPDX-License-Identifier: MIT |
|
10
|
|
|
""" |
|
11
|
|
|
|
|
12
|
|
|
|
|
13
|
|
|
def annuity(capex, n, wacc, u=None, cost_decrease=0): |
|
14
|
|
|
r"""Calculates the annuity of an initial investment 'capex', considering |
|
15
|
|
|
the cost of capital 'wacc' during a project horizon 'n' |
|
16
|
|
|
|
|
17
|
|
|
In case of a single initial investment, the employed formula reads: |
|
18
|
|
|
|
|
19
|
|
|
.. math:: |
|
20
|
|
|
\text{annuity} = \text{capex} \cdot |
|
21
|
|
|
\frac{(\text{wacc} \cdot (1+\text{wacc})^n)} |
|
22
|
|
|
{((1 + \text{wacc})^n - 1)} |
|
23
|
|
|
|
|
24
|
|
|
In case of repeated investments (due to replacements) at fixed intervals |
|
25
|
|
|
'u', the formula yields: |
|
26
|
|
|
|
|
27
|
|
|
.. math:: |
|
28
|
|
|
\text{annuity} = \text{capex} \cdot |
|
29
|
|
|
\frac{(\text{wacc} \cdot (1+\text{wacc})^n)} |
|
30
|
|
|
{((1 + \text{wacc})^n - 1)} \cdot \left( |
|
31
|
|
|
\frac{1 - \left( \frac{(1-\text{cost\_decrease})} |
|
32
|
|
|
{(1+\text{wacc})} \right)^n} |
|
33
|
|
|
{1 - \left(\frac{(1-\text{cost\_decrease})}{(1+\text{wacc})} |
|
34
|
|
|
\right)^u} \right) |
|
35
|
|
|
|
|
36
|
|
|
Parameters |
|
37
|
|
|
---------- |
|
38
|
|
|
capex : float |
|
39
|
|
|
Capital expenditure for first investment. Net Present Value (NPV) or |
|
40
|
|
|
Net Present Cost (NPC) of investment |
|
41
|
|
|
n : int |
|
42
|
|
|
Horizon of the analysis, or number of years the annuity wants to be |
|
43
|
|
|
obtained for (n>=1) |
|
44
|
|
|
wacc : float |
|
45
|
|
|
Weighted average cost of capital (0<wacc<1) |
|
46
|
|
|
u : int |
|
47
|
|
|
Lifetime of the investigated investment. Might be smaller than the |
|
48
|
|
|
analysis horizon, 'n', meaning it will have to be replaced. |
|
49
|
|
|
Takes value 'n' if not specified otherwise (u>=1) |
|
50
|
|
|
cost_decrease : float |
|
51
|
|
|
Annual rate of cost decrease (due to, e.g., price experience curve). |
|
52
|
|
|
This only influences the result for investments corresponding to |
|
53
|
|
|
replacements, whenever u<n. |
|
54
|
|
|
Takes value 0, if not specified otherwise (0<cost_decrease<1) |
|
55
|
|
|
Returns |
|
56
|
|
|
------- |
|
57
|
|
|
float |
|
58
|
|
|
annuity |
|
59
|
|
|
""" |
|
60
|
|
|
if u is None: |
|
61
|
|
|
u = n |
|
62
|
|
|
|
|
63
|
|
|
if ( |
|
64
|
|
|
(n < 1) |
|
65
|
|
|
or (wacc < 0 or wacc > 1) |
|
66
|
|
|
or (u < 1) |
|
67
|
|
|
or (cost_decrease < 0 or cost_decrease > 1) |
|
68
|
|
|
): |
|
69
|
|
|
raise ValueError("Input arguments for 'annuity' out of bounds!") |
|
70
|
|
|
|
|
71
|
|
|
return ( |
|
72
|
|
|
capex |
|
73
|
|
|
* (wacc * (1 + wacc) ** n) |
|
74
|
|
|
/ ((1 + wacc) ** n - 1) |
|
75
|
|
|
* ( |
|
76
|
|
|
(1 - ((1 - cost_decrease) / (1 + wacc)) ** n) |
|
77
|
|
|
/ (1 - ((1 - cost_decrease) / (1 + wacc)) ** u) |
|
78
|
|
|
) |
|
79
|
|
|
) |
|
80
|
|
|
|