|
11 | 11 | import pytest, numpy as np, biosteam as bst |
12 | 12 | from numpy.testing import assert_allclose |
13 | 13 | from biosteam import TEA, System, Stream, Unit, Chemical, settings |
| 14 | +from biosteam._tea import add_replacement_cost_to_cashflow_array |
14 | 15 | from biorefineries.tea import create_cellulosic_ethanol_tea |
15 | 16 |
|
16 | 17 | def test_depreciation_schedule(): |
@@ -336,9 +337,26 @@ def _FCI(self, TDC): # fixed capital investment |
336 | 337 | table['Loan principal [MM$]'].iloc[0]) |
337 | 338 | assert_allclose(total_interest_payment1, total_interest_payment2, atol=1e-4) |
338 | 339 |
|
| 340 | +def test_add_replacement_cost(): |
| 341 | + cashflow_array = np.zeros(12) |
| 342 | + |
| 343 | + add_replacement_cost_to_cashflow_array( |
| 344 | + equipment_installed_cost = 100.0, |
| 345 | + equipment_lifetime = 4, |
| 346 | + cashflow_array = cashflow_array, |
| 347 | + venture_years = 10, |
| 348 | + start = 2 |
| 349 | + ) |
| 350 | + |
| 351 | + expected = np.zeros(12) |
| 352 | + expected[6] = 100.0 |
| 353 | + expected[10] = 100.0 |
| 354 | + |
| 355 | + assert_allclose(cashflow_array, expected) |
339 | 356 |
|
340 | 357 | if __name__ == '__main__': |
341 | 358 | test_depreciation_schedule() |
342 | 359 | test_cashflow_consistency() |
343 | 360 | test_tea() |
344 | 361 | test_tea_startup_months() |
| 362 | + test_add_replacement_cost() |
0 commit comments