Skip to content

Commit

Permalink
adding LCOW per unit and per flow (#1398)
Browse files Browse the repository at this point in the history
* adding LCOW per unit and per flow

* by unit model name, not costing block name

* breakdown by individual flow

* Revert "breakdown by individual flow"

This reverts commit 7038557.

* Implement @adam-a-a's suggestions

* break out opex / capex

* adding aggregate

* add aggregate -- needs IDAES/idaes-pse#1414 (for now)

* better aggregation of variable unit costs

* better test

* add flow component breakdowns

* patch for expressions

* minor cleanup; cover a few more edge cases in unit model discovery for flows

* address commments from code review

* fix units error for multiplier

* add units check; add check for SECI

---------

Co-authored-by: Kurban Sitterley <kurban.sitterley@nrel.gov>
  • Loading branch information
bknueven and kurbansitterley authored Sep 27, 2024
1 parent ae41fe8 commit 31100db
Show file tree
Hide file tree
Showing 2 changed files with 330 additions and 10 deletions.
51 changes: 51 additions & 0 deletions watertap/costing/tests/test_costing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@

import pytest

from pyomo.util.check_units import assert_units_consistent
import pyomo.environ as pyo
import idaes.core as idc

from watertap.costing.watertap_costing_package import WaterTAPCosting
import watertap.flowsheets.lsrro.lsrro as lsrro


@pytest.mark.component
Expand Down Expand Up @@ -134,3 +136,52 @@ def test_watertap_costing_package():
m.fs.costing.capital_recovery_factor.fix()
# no error, wacc, capital_recovery_factor fixed
m.fs.costing.initialize()


@pytest.mark.component
def test_breakdowns():
m = lsrro.build()

m.fs.BoosterPumps[:].control_volume.work[0.0].value = 42e6
m.fs.EnergyRecoveryDevices[:].control_volume.work[0.0].value = -42e6

m.fs.costing.add_specific_electrical_carbon_intensity(
m.fs.product.properties[0].flow_vol
)

assert_units_consistent(m)

m.fs.costing.initialize()

total_LCOW = pyo.value(m.fs.costing.LCOW)

summed_aggregates = pyo.value(
sum(m.fs.costing.LCOW_aggregate_direct_capex.values())
+ sum(m.fs.costing.LCOW_aggregate_indirect_capex.values())
+ sum(m.fs.costing.LCOW_aggregate_fixed_opex.values())
+ sum(m.fs.costing.LCOW_aggregate_variable_opex.values())
# electricity is counted both in the aggregate variable opex
# per unit and per flow, so it is double-counted in this sum
- m.fs.costing.LCOW_aggregate_variable_opex["electricity"]
)
assert pytest.approx(total_LCOW) == summed_aggregates

summed_components = pyo.value(
sum(m.fs.costing.LCOW_component_direct_capex.values())
+ sum(m.fs.costing.LCOW_component_indirect_capex.values())
+ sum(m.fs.costing.LCOW_component_fixed_opex.values())
+ sum(m.fs.costing.LCOW_component_variable_opex.values())
)
assert pytest.approx(total_LCOW) == summed_components

sec = pyo.value(m.fs.costing.specific_energy_consumption)
summed_sec = pyo.value(
sum(m.fs.costing.specific_energy_consumption_component.values())
)
assert pytest.approx(sec) == summed_sec

seci = pyo.value(m.fs.costing.specific_electrical_carbon_intensity)
summed_seci = pyo.value(
sum(m.fs.costing.specific_electrical_carbon_intensity_component.values())
)
assert pytest.approx(seci) == summed_seci
Loading

0 comments on commit 31100db

Please sign in to comment.