Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
35da23d
initial refactor
kurbansitterley May 21, 2024
5f02b6a
initial separate for Clark model
kurbansitterley May 21, 2024
c302f93
initial separate for perry/lang
kurbansitterley May 21, 2024
1ca52ac
test harness ix
kurbansitterley May 21, 2024
4350daa
initial commit base
kurbansitterley May 21, 2024
611a76e
initial ix demin model
kurbansitterley May 22, 2024
23ed276
small rework of base model checkpoint
kurbansitterley May 22, 2024
3d570ed
__init__s
kurbansitterley May 22, 2024
59015a1
move some commented constraints to perry's
kurbansitterley May 22, 2024
cd90a57
initial costing changes for ix reorg
kurbansitterley May 22, 2024
e678380
model checkpoints
kurbansitterley May 22, 2024
2d6e040
Merge branch 'main' of https://github.com/kurbansitterley/watertap in…
kurbansitterley May 24, 2024
a78317b
demin checkpoint
kurbansitterley May 24, 2024
7b9af00
base checkpoint
kurbansitterley May 24, 2024
ad8ecfb
use equivalent flow
kurbansitterley May 24, 2024
adf693a
demin checkpoint
kurbansitterley May 28, 2024
4815354
base working with demin
kurbansitterley May 28, 2024
c8b819c
demin with charge ratio
kurbansitterley May 28, 2024
27b6da5
add IX demineralize costing option
kurbansitterley May 28, 2024
da5c9f6
add scaling to demin
kurbansitterley May 28, 2024
38dcdca
create ix testing directory
kurbansitterley May 28, 2024
6384583
initial ix demin test
kurbansitterley May 28, 2024
d7fe6c7
clean up base
kurbansitterley May 28, 2024
7646416
clean up demin
kurbansitterley May 28, 2024
b7a40ca
remove local attribute to resin cost
kurbansitterley May 29, 2024
983e63b
add back old model for comparison
kurbansitterley May 29, 2024
6560732
add clark model
kurbansitterley May 29, 2024
ea1a71b
working clark test
kurbansitterley May 29, 2024
104071d
rename perry to constant_pattern
kurbansitterley May 29, 2024
09a939b
add two refs to const pattern
kurbansitterley May 29, 2024
78b0130
add bv Var to base IX class; remove from inherited
kurbansitterley May 29, 2024
ebf389f
modify old for comparisons
kurbansitterley May 29, 2024
1305397
add ix constant pattern test
kurbansitterley May 29, 2024
8286585
bv scaling to base
kurbansitterley May 29, 2024
a9dec08
clean up clark test
kurbansitterley May 29, 2024
6698945
initial IXParmest commit
kurbansitterley May 29, 2024
0274f17
clean up ix base
kurbansitterley May 29, 2024
88c3086
move parmest plotting etc funcs to util
kurbansitterley May 29, 2024
6112ae5
rename constr
kurbansitterley May 29, 2024
8efd6ff
IXParmest checkpoint
kurbansitterley May 29, 2024
18dd5c8
clean up initial draft of IXParmest
kurbansitterley May 29, 2024
291b297
demo of initial IXParmest
kurbansitterley May 29, 2024
1aab6ad
move IonExchange0D out of ion_exchange directory
kurbansitterley May 29, 2024
2dc6ec4
initial commit for IX multi component model
kurbansitterley May 29, 2024
ec28926
fix class name in init
kurbansitterley May 29, 2024
acdd2a1
initial sorta working demo of IX multi component
kurbansitterley May 29, 2024
35a36b4
add smooth_max to ix MC
kurbansitterley May 30, 2024
ae10316
better demo for IX multi component
kurbansitterley May 30, 2024
660c7a9
clean up ix parmest; add some plot funcs
kurbansitterley May 30, 2024
f8bdbc8
run black
kurbansitterley May 30, 2024
6b71c61
add df_exp for experimental dataframe
kurbansitterley Jun 20, 2024
016e34d
undo df_exp creation
kurbansitterley Jun 20, 2024
102f266
fix just_plot_curve
kurbansitterley Jul 3, 2024
f99754b
plot excl_cnorms not excl_cbs; title not swapcase on plot labels
kurbansitterley Jul 3, 2024
ee504c2
Merge branch 'main' of https://github.com/kurbansitterley/watertap in…
kurbansitterley Jul 12, 2024
fef8e13
add thomas model
kurbansitterley Jul 15, 2024
855bcd2
add thomas model to IXParmest
kurbansitterley Jul 15, 2024
22a51bd
start to make plotting funcs model agnostic
kurbansitterley Jul 15, 2024
3f619ce
add method to save results/output; add input_data-->filtered_data
kurbansitterley Jul 15, 2024
5cc2a21
add saving funcs, results_dict funts
kurbansitterley Jul 15, 2024
c34d13d
clean up thomas
kurbansitterley Jul 17, 2024
25b4fa0
ixparmest checpoint
kurbansitterley Jul 17, 2024
89e826f
initial IX CPHSDM model - parmest working
kurbansitterley Jul 22, 2024
2dda424
messy modifications for parmest with CPHSDM model
kurbansitterley Jul 22, 2024
d497aaa
plotting and IX base model changes to work with CPHSDM and parmest
kurbansitterley Jul 22, 2024
8b04f08
temp remove redund columns
kurbansitterley Jul 24, 2024
d9aa519
add Sh and different Bi number calcs
kurbansitterley Jul 24, 2024
d66ae7b
the current disaster that is the parmest implementation
kurbansitterley Jul 24, 2024
1292cf6
checkpoint for parmest
kurbansitterley Jul 30, 2024
6d21c28
checkpoint parmest
kurbansitterley Aug 7, 2024
d086dab
Merge branch 'main' of https://github.com/kurbansitterley/watertap in…
kurbansitterley Aug 7, 2024
938a97e
CPHSDM checkpoint
kurbansitterley Aug 14, 2024
d809f4b
add scaling dicts to parmest
kurbansitterley Aug 14, 2024
597b31d
config option created
hunterbarber Jan 3, 2025
12d2ac1
Merge branch 'main' of https://github.com/kurbansitterley/watertap in…
kurbansitterley Mar 19, 2025
02e63d7
add initial ix base scaler
kurbansitterley Mar 19, 2025
0e476a0
Merge branch 'main' of https://github.com/kurbansitterley/watertap in…
kurbansitterley May 9, 2025
db77e4d
Merge branch 'main' into cphsdm_surrogates
kurbansitterley Aug 18, 2025
b833ce3
add gac CPHSDM surrogates
kurbansitterley Aug 18, 2025
4787db4
add ability to use surrogate models for min_N_St and throughput varia…
kurbansitterley Aug 18, 2025
9fdb385
add tests for surrogates
kurbansitterley Aug 18, 2025
67e6072
update docs with CPHSDM surrogate approach
kurbansitterley Aug 21, 2025
94dbbf5
doc changes
kurbansitterley Aug 21, 2025
0859ccd
re-organize doc; restructure and correct table
kurbansitterley Aug 21, 2025
25c2e71
Merge branch 'main' of https://github.com/kurbansitterley/watertap in…
kurbansitterley Aug 21, 2025
9fee0cf
move regen Vars/Params to unit model
kurbansitterley Aug 22, 2025
316b430
add regen Vars/Params; smooth_max for redund_cols; add other expressi…
kurbansitterley Aug 22, 2025
fcfb5be
add initialization routine; clean up and refactor
kurbansitterley Aug 22, 2025
bd76994
passing unit test
kurbansitterley Aug 22, 2025
fc3f37f
Merge branch 'main' into cphsdm_surrogates
kurbansitterley Aug 22, 2025
0818b08
Refactor ion exchange model: streamline parameters, enhance documenta…
kurbansitterley Aug 23, 2025
1ed5bf9
finish IX demin test
kurbansitterley Aug 23, 2025
0139abe
can't reassign resin_cost
kurbansitterley Aug 25, 2025
4335284
working CPHSDM
kurbansitterley Aug 25, 2025
2fb1efa
ix base working for both CPHSDM and demin
kurbansitterley Aug 25, 2025
427cbaf
first CPHSDM test
kurbansitterley Aug 25, 2025
b0319e5
fix conservation checks
kurbansitterley Aug 25, 2025
67f432f
improving scaling and initialization
kurbansitterley Aug 26, 2025
e061c81
finish tests for IX CPHSDM no surrogate
kurbansitterley Aug 26, 2025
b27a240
add IX CPHSDM surrogates
kurbansitterley Aug 26, 2025
043a4b7
spelling error; move some scaling factors
kurbansitterley Aug 26, 2025
99d38be
final CPHSDM model and test
kurbansitterley Aug 26, 2025
987704d
dont add ss approx
kurbansitterley Aug 27, 2025
fb232ac
ss approx using c_norm
kurbansitterley Aug 27, 2025
f73060c
clean up; add regen constr to ss approx
kurbansitterley Aug 27, 2025
8fadd55
final clark model
kurbansitterley Aug 28, 2025
66adc95
final clark test file
kurbansitterley Aug 28, 2025
2c10865
cosmetic changes
kurbansitterley Aug 28, 2025
e2874e1
remove old parmest file
kurbansitterley Aug 28, 2025
56c6fac
comment out so tests will run
kurbansitterley Aug 28, 2025
ee1335c
black so tests will run
kurbansitterley Aug 28, 2025
9853bb3
comment out demo for tests
kurbansitterley Aug 28, 2025
46b9aee
remove old IX model and test file
kurbansitterley Aug 28, 2025
b070eff
Merge branch 'cphsdm_surrogates' of https://github.com/hunterbarber/w…
kurbansitterley Aug 28, 2025
1e115f0
refator and rename
kurbansitterley Sep 1, 2025
aaf762c
add initial IX/GAC breakthrough curve parmest demo and all asssets
kurbansitterley Sep 1, 2025
27d1043
for demo: move to main tutorial directory and move code to external file
kurbansitterley Sep 1, 2025
b1a1747
add separate add_surrogates method
kurbansitterley Sep 1, 2025
e925f77
add trapezoidal ss effluent approximation as a config arg
kurbansitterley Sep 2, 2025
8d5febb
update docs
kurbansitterley Sep 2, 2025
78886a4
black
kurbansitterley Sep 2, 2025
d75d203
Merge branch 'cphsdm_surrogates' of https://github.com/hunterbarber/w…
kurbansitterley Sep 2, 2025
54a76b4
Merge branch 'main' into ix_reorg
kurbansitterley Sep 2, 2025
d5e6f1e
update demo
kurbansitterley Sep 2, 2025
07465a7
index some ss constraints and vars
kurbansitterley Sep 26, 2025
5d38ad3
refactor for indexed ss constraints; update tests
kurbansitterley Sep 26, 2025
2b00318
refactor add_ss_approximation: improve c_traps calculation with smoot…
kurbansitterley Sep 29, 2025
e69adc7
merge with multicomponent
kurbansitterley Sep 29, 2025
e8a7541
add multi component test initial
kurbansitterley Sep 29, 2025
e73cc3f
checkpoint for constant pattern model
kurbansitterley Sep 29, 2025
c831952
Merge branch 'main' of https://github.com/kurbansitterley/watertap in…
kurbansitterley Dec 29, 2025
ca7e10d
add demineralize as ix_type option
kurbansitterley Dec 30, 2025
2ade1e5
add CONFIG for num_traps; clean up
kurbansitterley Dec 30, 2025
c89393f
remove multicomponent functionality for now
kurbansitterley Dec 30, 2025
615044c
skip multicomponent tests for now
kurbansitterley Dec 30, 2025
4fcc323
comment existing IX 0d test
kurbansitterley Dec 30, 2025
7cf8e4d
remove multi component model and test file
kurbansitterley Dec 30, 2025
b05065c
remove ix parmest model, test, and data
kurbansitterley Dec 30, 2025
0b8c660
remove multicomponent and param est models from init
kurbansitterley Dec 30, 2025
2a5f34c
fix initialization for cphsdm
kurbansitterley Dec 30, 2025
e096a14
passing tests for cphsdm
kurbansitterley Dec 30, 2025
8b9cc92
remove ix/gac parmest demo
kurbansitterley Dec 30, 2025
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
478 changes: 375 additions & 103 deletions docs/technical_reference/unit_models/gac.rst

Large diffs are not rendered by default.

63 changes: 31 additions & 32 deletions watertap/costing/unit_models/ion_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,6 @@ def build_ion_exhange_cost_param_block(blk):
units=pyo.units.USD_2020 * pyo.units.gal**-1,
doc="Hazardous liquid disposal cost - EPA",
)
blk.regen_recycle = pyo.Var(
initialize=1,
units=pyo.units.dimensionless,
doc="Number of cycles the regenerant can be reused before disposal",
)


@register_costing_parameter_block(
Expand Down Expand Up @@ -205,23 +200,16 @@ def cost_ion_exchange(blk):
make_fixed_operating_cost_var(blk)
ion_exchange_params = blk.costing_package.ion_exchange
# Conversions to use units from cost equations in reference
tot_num_col = blk.unit_model.number_columns + blk.unit_model.number_columns_redund
col_vol_gal = pyo.units.convert(blk.unit_model.col_vol_per, to_units=pyo.units.gal)
bed_vol_ft3 = pyo.units.convert(blk.unit_model.bed_vol, to_units=pyo.units.ft**3)

ix_type = blk.unit_model.ion_exchange_type
blk.regen_soln_dens = pyo.Param(
initialize=1000,
units=pyo.units.kg / pyo.units.m**3,
mutable=True,
doc="Density of regeneration solution",
tot_num_col = (
blk.unit_model.number_columns + blk.unit_model.number_columns_redundant
)
blk.regen_dose = pyo.Param(
initialize=300,
units=pyo.units.kg / pyo.units.m**3,
mutable=True,
doc="Regenerant dose required for regeneration per volume of resin [kg regenerant/m3 resin]",
col_vol_gal = pyo.units.convert(
blk.unit_model.column_volume, to_units=pyo.units.gal
)
bed_vol_ft3 = pyo.units.convert(blk.unit_model.bed_volume, to_units=pyo.units.ft**3)

ix_type = blk.unit_model.ion_exchange_type

blk.capital_cost_vessel = pyo.Var(
initialize=1e5,
domain=pyo.NonNegativeReals,
Expand Down Expand Up @@ -255,7 +243,7 @@ def cost_ion_exchange(blk):
blk.flow_mass_regen_soln = pyo.Var(
initialize=1,
domain=pyo.NonNegativeReals,
units=pyo.units.kg / pyo.units.year,
units=pyo.units.kg / pyo.units.year, # kg regen soln / yr
doc="Regeneration solution flow",
)
blk.total_pumping_power = pyo.Var(
Expand All @@ -270,6 +258,13 @@ def cost_ion_exchange(blk):

elif ix_type == "anion":
resin_cost = ion_exchange_params.anion_exchange_resin_cost
elif ix_type == "demineralize":
resin_cost = (
ion_exchange_params.cation_exchange_resin_cost
* blk.unit_model.charge_ratio_cx
+ ion_exchange_params.anion_exchange_resin_cost
* blk.unit_model.charge_ratio_ax
)
else:
raise FrozenPipes(
f"Invalid ion exchange type {ix_type}. Valid types are 'cation' or 'anion'."
Expand Down Expand Up @@ -299,7 +294,7 @@ def cost_ion_exchange(blk):
initialize=1e5,
bounds=(0, None),
units=pyo.units.m**3 / blk.costing_package.base_period,
doc="Volumetric flow of resin per cycle", # assumes you are only replacing the operational columns, t_cycle = t_breakthru
doc="Volumetric flow of resin per cycle", # assumes you are only replacing the operational columns, cycle_time = breakthrough_time
)
blk.single_use_resin_replacement_cost = pyo.Var(
initialize=1e5,
Expand All @@ -311,12 +306,12 @@ def cost_ion_exchange(blk):
blk.flow_vol_resin_constraint = pyo.Constraint(
expr=blk.flow_vol_resin
== pyo.units.convert(
blk.unit_model.bed_vol_tot / blk.unit_model.t_breakthru,
blk.unit_model.bed_volume_total / blk.unit_model.breakthrough_time,
to_units=pyo.units.m**3 / blk.costing_package.base_period,
)
)
blk.mass_flow_resin = pyo.units.convert(
blk.flow_vol_resin * blk.unit_model.resin_bulk_dens,
blk.flow_vol_resin * blk.unit_model.resin_density,
to_units=pyo.units.ton / blk.costing_package.base_period,
)
else:
Expand All @@ -341,8 +336,8 @@ def cost_ion_exchange(blk):
blk.backwash_tank_vol = pyo.Expression(
expr=pyo.units.convert(
(
blk.unit_model.bw_flow * blk.unit_model.t_bw
+ blk.unit_model.rinse_flow * blk.unit_model.t_rinse
blk.unit_model.backwash_flow_rate * blk.unit_model.backwash_time
+ blk.unit_model.rinse_flow_rate * blk.unit_model.rinse_time
),
to_units=pyo.units.gal,
)
Expand Down Expand Up @@ -385,7 +380,7 @@ def cost_ion_exchange(blk):
)
else:
bed_mass_ton = pyo.units.convert(
blk.unit_model.bed_vol * blk.unit_model.resin_bulk_dens,
blk.unit_model.bed_volume * blk.unit_model.resin_density,
to_units=pyo.units.ton,
)
blk.operating_cost_hazardous_constraint = pyo.Constraint(
Expand All @@ -398,7 +393,7 @@ def cost_ion_exchange(blk):
)
* ion_exchange_params.annual_resin_replacement_factor
+ pyo.units.convert(
blk.flow_mass_regen_soln / blk.regen_soln_dens,
blk.flow_mass_regen_soln / blk.unit_model.regen_soln_dens,
to_units=pyo.units.gal / pyo.units.year,
)
* ion_exchange_params.hazardous_regen_disposal
Expand Down Expand Up @@ -447,10 +442,14 @@ def cost_ion_exchange(blk):
expr=blk.flow_mass_regen_soln
== pyo.units.convert(
(
(blk.regen_dose * blk.unit_model.bed_vol * tot_num_col)
/ (blk.unit_model.t_cycle)
(
blk.unit_model.regen_dose
* blk.unit_model.bed_volume
* tot_num_col
)
/ (blk.unit_model.cycle_time)
)
/ ion_exchange_params.regen_recycle,
/ blk.unit_model.regen_recycle,
to_units=pyo.units.kg / pyo.units.year,
)
)
Expand All @@ -461,7 +460,7 @@ def cost_ion_exchange(blk):

power_expr = (
blk.unit_model.main_pump_power
+ blk.unit_model.bw_pump_power
+ blk.unit_model.backwash_pump_power
+ blk.unit_model.rinse_pump_power
)
if blk.unit_model.config.regenerant != "single_use":
Expand Down
Empty file.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Empty file.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Loading