-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ElectroNP ZO model with UnitModelBlockData base (#1020)
* add * delete redundant files * Add ElectroNP ZO model * refine code * Update watertap/unit_models/electroNP_ZO.py Co-authored-by: MarcusHolly <[email protected]> * Update watertap/unit_models/electroNP_ZO.py Co-authored-by: Adam Atia <[email protected]> * refine model --------- Co-authored-by: MarcusHolly <[email protected]> Co-authored-by: Adam Atia <[email protected]>
- Loading branch information
1 parent
cd2ec4d
commit 1334584
Showing
5 changed files
with
878 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
################################################################################# | ||
# WaterTAP Copyright (c) 2020-2023, The Regents of the University of California, | ||
# through Lawrence Berkeley National Laboratory, Oak Ridge National Laboratory, | ||
# National Renewable Energy Laboratory, and National Energy Technology | ||
# Laboratory (subject to receipt of any required approvals from the U.S. Dept. | ||
# of Energy). All rights reserved. | ||
# | ||
# Please see the files COPYRIGHT.md and LICENSE.md for full copyright and license | ||
# information, respectively. These files are also available online at the URL | ||
# "https://github.com/watertap-org/watertap/" | ||
################################################################################# | ||
|
||
import pyomo.environ as pyo | ||
from ..util import ( | ||
register_costing_parameter_block, | ||
make_capital_cost_var, | ||
) | ||
|
||
|
||
def build_electroNP_cost_param_block(blk): | ||
|
||
blk.HRT = pyo.Var( | ||
initialize=1.3333, | ||
doc="Hydraulic retention time", | ||
units=pyo.units.hr, | ||
) | ||
blk.sizing_cost = pyo.Var( | ||
initialize=1.25, | ||
doc="Reactor sizing cost", | ||
units=pyo.units.USD_2020 / pyo.units.m**3, | ||
) | ||
|
||
|
||
@register_costing_parameter_block( | ||
build_rule=build_electroNP_cost_param_block, | ||
parameter_block_name="electroNP", | ||
) | ||
def cost_electroNP(blk, cost_electricity_flow=True, cost_MgCl2_flow=True): | ||
""" | ||
ElectroNP costing method | ||
""" | ||
cost_electroNP_capital( | ||
blk, | ||
blk.costing_package.electroNP.HRT, | ||
blk.costing_package.electroNP.sizing_cost, | ||
) | ||
|
||
t0 = blk.flowsheet().time.first() | ||
if cost_electricity_flow: | ||
blk.costing_package.cost_flow( | ||
pyo.units.convert( | ||
blk.unit_model.electricity[t0], | ||
to_units=pyo.units.kW, | ||
), | ||
"electricity", | ||
) | ||
|
||
if cost_MgCl2_flow: | ||
blk.costing_package.cost_flow( | ||
pyo.units.convert( | ||
blk.unit_model.MgCl2_flowrate[t0], | ||
to_units=pyo.units.kg / pyo.units.hr, | ||
), | ||
"magnesium chloride", | ||
) | ||
|
||
|
||
def cost_electroNP_capital(blk, HRT, sizing_cost): | ||
""" | ||
Generic function for costing an ElectroNP system. | ||
""" | ||
make_capital_cost_var(blk) | ||
|
||
blk.HRT = pyo.Expression(expr=HRT) | ||
blk.sizing_cost = pyo.Expression(expr=sizing_cost) | ||
|
||
flow_in = pyo.units.convert( | ||
blk.unit_model.properties_in[0].flow_vol, | ||
to_units=pyo.units.m**3 / pyo.units.hr, | ||
) | ||
|
||
print(f"base_currency: {blk.costing_package.base_currency}") | ||
blk.capital_cost_constraint = pyo.Constraint( | ||
expr=blk.capital_cost | ||
== pyo.units.convert( | ||
blk.HRT * flow_in * blk.sizing_cost, | ||
to_units=blk.costing_package.base_currency, | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.