Skip to content

Commit

Permalink
Merge pull request #966 from rl-institut/fix/cost-calculation-reinves…
Browse files Browse the repository at this point in the history
…t-in-project-last-year

Fix a bug in replacement cost calculation reinvest in project last year
  • Loading branch information
Bachibouzouk authored Apr 27, 2024
2 parents 3e19405 + 39dfd4d commit 3a2b194
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ Here is a template for new release sections
- Transformers can have multiple input or output busses (tested in `tests/test_D1_model_components` by `test_transformer_optimize_cap_multiple_output_busses_multiple_inst_cap`, `test_transformer_optimize_cap_multiple_output_busses_multiple_max_add_cap`, `test_transformer_fix_cap_multiple_output_busses_multiple_inst_cap` and in `tests/test_benchmark_special_features` by `test_benchmark_feature_parameters_as_timeseries_multiple_inputs`)(#949)
- The constraints are not all set to default values if only one constraint is missing, only the missing constraint is set to default value (#953)
- If the age of an asset is such that it should be replaced on the project's last year, we do not take it into account as the resell price would be deduced anyway (#965)
- The test `test_c2_economic_functions.py::test_get_replacement_costs_one_reinvestment_age_asset_equal_asset_lifetime` was added to account for a field usecase and a solution was provided (#966)


## [1.0.0] - 2021-05-31

Expand Down
12 changes: 12 additions & 0 deletions tests/test_C2_economic_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,18 @@ def test_get_replacement_costs_no_reinvestment_residual():
assert replacement_costs == exp


def test_get_replacement_costs_one_reinvestment_age_asset_equal_asset_lifetime():
replacement_costs = C2.get_replacement_costs(
age_of_asset=10,
project_lifetime=20,
asset_lifetime=10,
first_time_investment=550,
discount_factor=0.1,
)
exp = 762.0488091862422
assert replacement_costs == exp


def test_present_value_from_annuity():
"""
Expand Down

0 comments on commit 3a2b194

Please sign in to comment.