Skip to content

Commit 730081f

Browse files
authored
Merge pull request #244 from IsaacLeis/tea-fixes
Fix replacement cost timing and refactor cashflow calculations
2 parents 9d66150 + c3a67df commit 730081f

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/test_tea.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import pytest, numpy as np, biosteam as bst
1212
from numpy.testing import assert_allclose
1313
from biosteam import TEA, System, Stream, Unit, Chemical, settings
14+
from biosteam._tea import add_replacement_cost_to_cashflow_array
1415
from biorefineries.tea import create_cellulosic_ethanol_tea
1516

1617
def test_depreciation_schedule():
@@ -336,9 +337,26 @@ def _FCI(self, TDC): # fixed capital investment
336337
table['Loan principal [MM$]'].iloc[0])
337338
assert_allclose(total_interest_payment1, total_interest_payment2, atol=1e-4)
338339

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)
339356

340357
if __name__ == '__main__':
341358
test_depreciation_schedule()
342359
test_cashflow_consistency()
343360
test_tea()
344361
test_tea_startup_months()
362+
test_add_replacement_cost()

0 commit comments

Comments
 (0)