Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c80c5d8
Migrate costing metrics from valorization_costing_block
Apr 21, 2026
4245fd4
Update watertap/costing/watertap_costing_package.py
luohezhiming May 5, 2026
3f5b256
Update watertap/costing/watertap_costing_package.py
luohezhiming May 5, 2026
4a697a7
Update watertap/costing/watertap_costing_package.py
luohezhiming May 5, 2026
13b5060
Update watertap/costing/watertap_costing_package.py
luohezhiming May 5, 2026
95034fe
add general metrics
luohezhiming May 14, 2026
e4df958
Merge branch 'main' into migrate_valorization_costing_block
luohezhiming May 14, 2026
3796227
delete redundant comments
luohezhiming May 14, 2026
c1ad3f8
delete redundant comment
luohezhiming May 14, 2026
f7565b7
Merge branch 'main' into migrate_valorization_costing_block
tristantc Jul 2, 2026
58df86b
Refactor flow component breakdown methods and enhance documentation f…
tristantc Jul 2, 2026
d834d32
Keep `add_LCOW` as a thin wrapper around the generic helper `add_leve…
tristantc Jul 2, 2026
5d280a4
Refactor levelized-cost helper: rename for reuse, improve docs
tristantc Jul 2, 2026
040f3d5
Refactor flow component breakdown: update flow units and improve meth…
tristantc Jul 2, 2026
612ecbc
Refactor flow unit calculations
tristantc Jul 2, 2026
a3e3c27
Refactor annual water production calculation: replace expression with…
tristantc Jul 2, 2026
6caae27
Refactor `add_specific_electrical_carbon_intensity`: enhance flow bas…
tristantc Jul 2, 2026
97a6db4
Refactor `add_flow_component`: improve documentation and add validati…
tristantc Jul 2, 2026
14eda46
Add unit-consistency checks for `flow_rate` vs `flow_basis` in costin…
tristantc Jul 16, 2026
69d1a1b
add valueeffor for mismatch
luohezhiming Jul 16, 2026
773d0f9
Merge branch 'main' into migrate_valorization_costing_block
luohezhiming Jul 16, 2026
c07ff13
Merge branch 'migrate_valorization_costing_block' of https://github.c…
luohezhiming Jul 16, 2026
a08dbb5
Fix method name for flow component breakdowns in WaterTAPCostingBlock…
tristantc Jul 16, 2026
e41f96e
Refactor flow component breakdown methods in WaterTAPCostingBlockData…
tristantc Jul 16, 2026
da8a317
Fix argument order in add_flow_component_breakdown for NaCl usage in …
tristantc Jul 16, 2026
55830d0
docs: fix argument order in `add_flow_component_breakdown` examples a…
tristantc Jul 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions watertap/costing/tests/test_costing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,25 @@ def test_breakdowns():
m.fs.costing.add_specific_electrical_carbon_intensity(
m.fs.product.properties[0].flow_vol
)
# Tests for performance indices introduced from valorization_costing_block
m.fs.costing.add_LCOP(
sum(
m.fs.product.properties[0].flow_mass_phase_comp["Liq", comp]
for comp in m.fs.properties.component_list
)
)
m.fs.costing.add_mass_based_specific_energy_consumption(
sum(
m.fs.product.properties[0].flow_mass_phase_comp["Liq", comp]
for comp in m.fs.properties.component_list
)
)
m.fs.costing.add_annual_product_generation(
sum(
m.fs.product.properties[0].flow_mass_phase_comp["Liq", comp]
for comp in m.fs.properties.component_list
)
)

assert_units_consistent(m)

Expand Down
63 changes: 63 additions & 0 deletions watertap/costing/watertap_costing_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,24 @@ def add_LCOW(self, flow_rate, name="LCOW"):
flow_cost * self.utilization_factor
) / denominator

def add_LCOP(self, mass_product, name="LCOP"):
denominator = (
pyo.units.convert(mass_product, to_units=pyo.units.kg / self.base_period)
* self.utilization_factor
)

self.add_component(
name,
pyo.Expression(
expr=(
self.total_capital_cost * self.capital_recovery_factor

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, we actually have total_annualized_cost Expression that we can simply use here in stread-> will make it alot more clear.

@avdudchenko avdudchenko Jul 30, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So then here we would simply


 self.add_component(
            name,
            pyo.Expression(
                expr=pyunits.convert((self.total_annualzied_cost/(flow_rate*utiliation_factor), to_unit=normalized_units[flow_type]))

Where normalzied units is either pre-registerd dict unit or user supplied unit in cost/amount format

so we would need
normalized_units={'mass':self.base_currency/pyunits.kg... etc}

Then if user provides a desired unit, we use it instead of the one registed.

+ self.total_operating_cost
)
/ denominator,
doc=f"Levelized Cost of Product",
Comment thread
luohezhiming marked this conversation as resolved.
Outdated
),
)

@staticmethod
def _find_flow_unit(flow_expr):
"""
Expand Down Expand Up @@ -308,6 +326,27 @@ def add_specific_energy_consumption(
"electricity", name, flow_rate, utilization_factor=1.0, period=pyo.units.hr
)

def add_mass_based_specific_energy_consumption(
self, flow_rate, name="mass_based_specific_energy_consumption"
):
"""
Add specific energy consumption (kWh/kg) to costing block.
Args:
flow_rate - flow rate of water (mass-based) to be used in
calculating specific energy consumption
name (optional) - the name of the Expression for the specific
energy consumption (default: specific_energy_consumption)
"""

self.add_component(
name,
pyo.Expression(
expr=self.aggregate_flow_electricity
/ pyo.units.convert(flow_rate, to_units=pyo.units.kg / pyo.units.hr),
doc=f"Specific energy consumption based on product mass",
Comment thread
luohezhiming marked this conversation as resolved.
Outdated
),
)

def add_annual_water_production(self, flow_rate, name="annual_water_production"):
"""
Add annual water production to costing block.
Expand All @@ -330,6 +369,30 @@ def add_annual_water_production(self, flow_rate, name="annual_water_production")
),
)

def add_annual_product_generation(
self, flow_rate, name="annual_product_generation"
):
"""
Add annual water production to costing block.
Comment thread
luohezhiming marked this conversation as resolved.
Outdated
Args:
flow_rate - flow rate of product (mass-based) to be used in
calculating annual product generation
name (optional) - name for the annual product generation variable
Expression (default: annual_product_generation)
"""
self.add_component(
name,
pyo.Expression(
expr=(
pyo.units.convert(
flow_rate, to_units=pyo.units.kg / self.base_period
)
* self.utilization_factor
),
doc=f"Annual product generation based on mass flow ",
Comment thread
luohezhiming marked this conversation as resolved.
Outdated
),
)

def add_electricity_intensity(self, flow_rate, name="electricity_intensity"):
"""
Add calculation of overall electricity intensity to costing block.
Expand Down
Loading