Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more detailed pressure exchanger #1264

Merged
merged 131 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 121 commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
7d35890
add
luohezhiming Mar 16, 2023
4766c52
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Mar 16, 2023
ef81bae
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Mar 22, 2023
168bbaf
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Mar 27, 2023
a09b4e9
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Mar 30, 2023
44a22e8
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Mar 31, 2023
1c1a135
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Apr 5, 2023
401f997
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Apr 10, 2023
258f6fe
delete redundant files
luohezhiming Apr 11, 2023
2c994c3
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Apr 17, 2023
5b6baed
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Apr 21, 2023
0afa551
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Apr 24, 2023
479fb6d
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Apr 28, 2023
b393ed0
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming May 9, 2023
708ad0a
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming May 12, 2023
5a69761
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming May 17, 2023
112415a
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming May 19, 2023
93737c0
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming May 25, 2023
3162e34
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming May 26, 2023
637b32d
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming May 29, 2023
ea4e066
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jun 5, 2023
84a2900
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jun 7, 2023
17bc5e3
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jun 12, 2023
f816483
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jun 13, 2023
fea68e3
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jun 14, 2023
c19fba5
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jun 20, 2023
0754d21
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jun 22, 2023
9dcece1
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jun 22, 2023
a5325c9
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jun 27, 2023
c4bc3ef
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jul 5, 2023
bb8ca41
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jul 7, 2023
5afdc55
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jul 11, 2023
35ecf79
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jul 12, 2023
fb2a100
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jul 17, 2023
40b4de5
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jul 19, 2023
72f6f25
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jul 21, 2023
ece1d2f
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Aug 2, 2023
a861a5b
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Aug 7, 2023
d58a9a7
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Aug 9, 2023
4968282
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Aug 19, 2023
acfd9f6
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Aug 23, 2023
a97fbe3
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Aug 24, 2023
2fc2425
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Aug 25, 2023
581dec0
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Sep 4, 2023
3202970
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Sep 20, 2023
625e610
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Sep 25, 2023
2a37aca
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Oct 2, 2023
1fa9316
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Oct 3, 2023
74811ea
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Oct 16, 2023
a89268c
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Oct 16, 2023
09cf01e
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Oct 19, 2023
4070fa1
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Oct 20, 2023
0d6fe1a
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Oct 23, 2023
0f09c3c
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Nov 6, 2023
5f82e05
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Nov 9, 2023
025f9b6
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Nov 13, 2023
af92e14
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Nov 15, 2023
c61fc6d
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Nov 16, 2023
87fbfaf
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Nov 17, 2023
cc20cf2
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Nov 22, 2023
20a0b7b
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Nov 22, 2023
7e4224f
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Nov 27, 2023
e48e352
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Nov 30, 2023
2e0c474
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Dec 6, 2023
88c873d
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Dec 7, 2023
d75ea4e
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Dec 14, 2023
4cc24eb
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Dec 15, 2023
64eb819
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Dec 30, 2023
3b03877
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jan 2, 2024
d3a6ab1
Add more detailed pressure exchanger
luohezhiming Jan 5, 2024
9757884
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jan 5, 2024
0ebf06f
Merge branch 'main' into pressure_exchanger
luohezhiming Jan 5, 2024
9bb69e6
code linting
luohezhiming Jan 5, 2024
3763004
minor changes
luohezhiming Jan 8, 2024
758cb64
add test for multi_comp property package
luohezhiming Jan 9, 2024
cc171a6
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jan 12, 2024
5ec6f28
revise documentation
luohezhiming Jan 16, 2024
6ca2fd5
Merge branch 'main' into pressure_exchanger
luohezhiming Jan 16, 2024
fbdfae9
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jan 19, 2024
c0c4ba6
change efficiency to universal variable
luohezhiming Jan 22, 2024
65b13bd
temporary version
luohezhiming Jan 22, 2024
76dba51
Revise doc
luohezhiming Jan 22, 2024
65a7c7c
Merge branch 'main' into pressure_exchanger
luohezhiming Jan 22, 2024
27af569
code pylint
luohezhiming Jan 22, 2024
05b573a
Resolve test problem
luohezhiming Jan 23, 2024
799e3b0
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jan 25, 2024
324685e
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Jan 30, 2024
4158c7e
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Feb 2, 2024
5f8b7d1
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Feb 5, 2024
17d268c
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Feb 7, 2024
383a9d8
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Feb 7, 2024
49bdc5f
New version of PX
luohezhiming Feb 28, 2024
9a05662
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Feb 28, 2024
5c3bf00
Merge branch 'main' into pressure_exchanger
luohezhiming Feb 28, 2024
09999f2
revise bounds for LPD
luohezhiming Feb 28, 2024
dc90131
revise leakage equations
luohezhiming Feb 28, 2024
a52cc86
update doc
luohezhiming Feb 28, 2024
9955635
code linting
luohezhiming Feb 28, 2024
e38625d
revise typo
luohezhiming Feb 28, 2024
4a29707
revise typos
luohezhiming Feb 28, 2024
dd00a3f
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Feb 28, 2024
8175c28
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Feb 28, 2024
129fb22
Merge branch 'main' into pressure_exchanger
adam-a-a Feb 28, 2024
5013151
Update docs/technical_reference/unit_models/pressure_exchanger.rst
luohezhiming Feb 29, 2024
f32c0ea
Update docs/technical_reference/unit_models/pressure_exchanger.rst
luohezhiming Feb 29, 2024
3476d2b
Update docs/technical_reference/unit_models/pressure_exchanger.rst
luohezhiming Feb 29, 2024
e4c1155
Update docs/technical_reference/unit_models/pressure_exchanger.rst
luohezhiming Feb 29, 2024
798976a
Update docs/technical_reference/unit_models/pressure_exchanger.rst
luohezhiming Feb 29, 2024
ad86c56
Update watertap/unit_models/pressure_exchanger.py
luohezhiming Feb 29, 2024
d4541b8
Update watertap/unit_models/pressure_exchanger.py
luohezhiming Feb 29, 2024
252b899
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Feb 29, 2024
4847be5
Merge branch 'main' into pressure_exchanger
luohezhiming Feb 29, 2024
3372c26
add comments
luohezhiming Feb 29, 2024
f7f569a
resolve issue with inden
luohezhiming Feb 29, 2024
31dd1e1
rename LPS to feed_side and HPS to brine_side
luohezhiming Mar 4, 2024
9de729a
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Mar 4, 2024
94753a7
Merge branch 'main' into pressure_exchanger
luohezhiming Mar 4, 2024
ba817e3
resolve tests problems
luohezhiming Mar 4, 2024
22e9b95
revise test file
luohezhiming Mar 4, 2024
349b52c
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Mar 4, 2024
3616989
Merge branch 'main' into pressure_exchanger
luohezhiming Mar 4, 2024
b0e7287
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Mar 12, 2024
f5446bb
Merge branch 'main' into pressure_exchanger
luohezhiming Mar 12, 2024
74abee6
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Mar 21, 2024
9989167
efficiency equation change to ener_out/ener_in
luohezhiming Mar 25, 2024
dc73edf
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Mar 25, 2024
5f0a61c
has_leakage for initialization
luohezhiming Mar 25, 2024
8fd87d2
Merge branch 'main' of https://github.com/watertap-org/watertap
luohezhiming Mar 25, 2024
90aabef
Merge branch 'main' into pressure_exchanger
luohezhiming Mar 25, 2024
335f6db
Adjust dye desal with RO test solutions
MarcusHolly Mar 25, 2024
038b320
Merge branch 'main' into pressure_exchanger
MarcusHolly Mar 25, 2024
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
66 changes: 59 additions & 7 deletions docs/technical_reference/unit_models/pressure_exchanger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ This pressure exchanger unit model:
* is isothermal
* supports a single liquid phase only
* supports steady-state only
* assumes no mixing or leakage between the low and high pressure side
* assumes equal flowrates on both sides
* supports leakage and mixing effect

.. index::
pair: watertap.unit_models.pressure_exchanger;pressure_exchanger
Expand All @@ -32,9 +31,16 @@ Where the system is also subject to following constraints:

Figure 1. Schematic representation of an energy recovery system using a pressure exchanger.

When setting the ``has_mixing`` configuration option to ``True``, there is 1 additional variable ``mixing_vol`` that must be fixed.
luohezhiming marked this conversation as resolved.
Show resolved Hide resolved

When setting the ``has_leakage`` configuration option to ``True``, there is 1 additional variable ``leakage_vol`` that must be fixed.
luohezhiming marked this conversation as resolved.
Show resolved Hide resolved

When setting the ``pressure_exchange_calculation`` configuration option to ``PressureExchangeType.high_pressure_difference``,
there are 2 additional variables ``high_pressure_difference`` and ``low_pressure_difference`` that must be fixed. Instead, ``efficiency_pressure_exchanger`` is unfixed.

Model Structure
------------------
The pressure exchanger model consists of 2 `ControlVolume0DBlocks`: one for the low-pressure side and high-pressure side.
The pressure exchanger model consists of 2 `ControlVolume0DBlocks`: one for the feed side and brine side.

Sets
----
Expand All @@ -56,8 +62,14 @@ The pressure exchanger unit model includes the following variables:
:header: "Description", "Symbol", "Variable Name", "Index", "Units", "Pyomo Type"

"Efficiency", ":math:`\eta`", "efficiency_pressure_exchanger", "[t]", ":math:`\text{dimensionless}`", "Var"
"Volumetric leakage fraction", ":math:`\delta`", "leakage_vol", "[t]", ":math:`\text{dimensionless}`", "Var"
"Volumetric mixing fraction", ":math:`\chi`", "mixing_vol", "[t]", ":math:`\text{dimensionless}`", "Var"
"High pressure difference*", ":math:`HPD`", "high_pressure_difference", "[t]", ":math:`\text{Pa}`", "Var"
"Low pressure difference*", ":math:`LPD`", "low_pressure_difference", "[t]", ":math:`\text{Pa}`", "Var"

\*High pressure difference and low pressure difference are non-negative values

Each control volume (i.e. `low_presssure_side`, and `high_pressure_side`) has the following variables of interest:
Each control volume (i.e. `feed_side`, and `brine_side`) has the following variables of interest:

.. csv-table::
:header: "Description", "Symbol", "Variable Name", "Index", "Units", "Pyomo Type"
Expand All @@ -72,7 +84,9 @@ Each property block on both control volumes (i.e. `properties_in` and `propertie
.. csv-table::
:header: "Description", "Symbol", "Variable Name", "Index", "Units", "Pyomo Type"

"Mass flowrate", ":math:`M`", "flow_mass_phase_comp", "[p, j]", "\*", "Var"
"Volumetric flowrate", ":math:`Q`", "flow_vol", "None", "\*", "Var"
"Concentration", ":math:`C`", "conc_mass_phase_comp", "[p, j]", "\*", "Var"
"Temperature", ":math:`T`", "temperature", "[t]", "\*", "Var"
"Pressure", ":math:`P`", "pressure", "[t]", "\*", "Var"

Expand All @@ -81,17 +95,55 @@ Each property block on both control volumes (i.e. `properties_in` and `propertie

Equations
-----------
if ``has_leakage`` and ``has_mixing`` are set to default (``False``):

.. csv-table::
:header: "Description", "Equation"

"Mass balance for each side", ":math:`M_{out, j} = M_{in, j}`"
"Momentum balance for each side", ":math:`P_{out} = P_{in} + ΔP`"
"Isothermal assumption for each side", ":math:`T_{out} = T_{in}`"
"Equal volumetric flowrate*", ":math:`Q_{LPS} = Q_{HPS}`"
"Pressure transfer*", ":math:`ΔP_{LPS} = - \eta ΔP_{HPS}`"
"Equal volumetric flowrate*", ":math:`Q_{out, F} = Q_{in, F}`"
"Equal pressure*", ":math:`P_{out, B} = P_{in, F}`"
"Pressure transfer*", ":math:`ΔP_{F} = - \eta ΔP_{B}`"

\* F stands for feed side, B stands for brine side

if ``has_leakage`` is set to ``True``, then the equal volumetric flowrate equation is replaced by:

.. csv-table::
:header: "Description", "Equation"

"Equal volumetric flowrate", ":math:`Q_{out, F} = (1 - \delta) Q_{in, B}`"

if ``has_mixing`` is set to ``True``, the mass balance equations for each side become:

.. csv-table::
:header: "Description", "Equation"

"Mass balance for each side*", ":math:`M_{out, j} = M_{in, j} + MTT_{j}`"

\* MTT is mass transfer term into the control volume

and there are 3 additional constraints:

.. csv-table::
:header: "Description", "Equation"

"Mixing effect of solute*", ":math:`C_{out, F} = C_{in, F} (1-\chi) + C_{in, B} \chi`"
"Linking mass transfer terms", ":math:`MTT_{j, F} = -MTT_{j, B}`"
"Equal feed side volumetric flowrate", ":math:`Q_{out, F} = Q_{in, F}`"

\* C represents solute concentration

if ``pressure_change_calculation`` is set to ``PressureExchangeType.high_pressure_difference``,
then there is 1 additional constraint and the equal pressure equation is replaced:

.. csv-table::
:header: "Description", "Equation"

\* LPS stands for low pressure side, HPS stands for high pressure side
"Pressure drop across B,in and F, out", ":math:`P_{out, F} + HPD = P_{in, B}`"
"Pressure drop across B, out and F, in", ":math:`P_{out, B} = P_{in, F} + LPD`"

Class Documentation
-------------------
Expand Down
2 changes: 1 addition & 1 deletion watertap/costing/unit_models/pressure_exchanger.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def cost_pressure_exchanger(blk):
blk,
blk.costing_package.pressure_exchanger.cost,
pyo.units.convert(
blk.unit_model.low_pressure_side.properties_in[0].flow_vol,
blk.unit_model.feed_side.properties_in[0].flow_vol,
(pyo.units.meter**3 / pyo.units.hours),
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,10 @@ def build(erd_type=ERDtype.pressure_exchanger):
m.fs.s03 = Arc(source=m.fs.P1.outlet, destination=m.fs.M1.P1)
m.fs.s04 = Arc(source=m.fs.M1.outlet, destination=m.fs.RO.inlet)
m.fs.s05 = Arc(source=m.fs.RO.permeate, destination=m.fs.product.inlet)
m.fs.s06 = Arc(
source=m.fs.RO.retentate, destination=m.fs.PXR.high_pressure_inlet
)
m.fs.s07 = Arc(
source=m.fs.PXR.high_pressure_outlet, destination=m.fs.disposal.inlet
)
m.fs.s08 = Arc(source=m.fs.S1.PXR, destination=m.fs.PXR.low_pressure_inlet)
m.fs.s09 = Arc(source=m.fs.PXR.low_pressure_outlet, destination=m.fs.P2.inlet)
m.fs.s06 = Arc(source=m.fs.RO.retentate, destination=m.fs.PXR.brine_inlet)
m.fs.s07 = Arc(source=m.fs.PXR.brine_outlet, destination=m.fs.disposal.inlet)
m.fs.s08 = Arc(source=m.fs.S1.PXR, destination=m.fs.PXR.feed_inlet)
m.fs.s09 = Arc(source=m.fs.PXR.feed_outlet, destination=m.fs.P2.inlet)
m.fs.s10 = Arc(source=m.fs.P2.outlet, destination=m.fs.M1.P2)
elif erd_type == ERDtype.pump_as_turbine:
m.fs.s01 = Arc(source=m.fs.feed.outlet, destination=m.fs.P1.inlet)
Expand All @@ -184,8 +180,8 @@ def build(erd_type=ERDtype.pressure_exchanger):

if erd_type == ERDtype.pressure_exchanger:
iscale.set_scaling_factor(m.fs.P2.control_volume.work, 1e-3)
iscale.set_scaling_factor(m.fs.PXR.low_pressure_side.work, 1e-3)
iscale.set_scaling_factor(m.fs.PXR.high_pressure_side.work, 1e-3)
iscale.set_scaling_factor(m.fs.PXR.feed_side.work, 1e-3)
iscale.set_scaling_factor(m.fs.PXR.brine_side.work, 1e-3)
# touch properties used in specifying and initializing the model
m.fs.S1.mixed_state[0].mass_frac_phase_comp
m.fs.S1.PXR_state[0].flow_vol_phase["Liq"]
Expand Down Expand Up @@ -407,7 +403,7 @@ def initialize_pressure_exchanger(m, optarg):
# ---initialize splitter and pressure exchanger---
# pressure exchanger high pressure inlet
propagate_state(m.fs.s06) # propagate to PXR high pressure inlet from RO retentate
m.fs.PXR.high_pressure_side.properties_in.initialize(optarg=optarg)
m.fs.PXR.brine_side.properties_in.initialize(optarg=optarg)

# splitter inlet
propagate_state(m.fs.s01) # propagate to splitter inlet from feed
Expand All @@ -421,7 +417,7 @@ def initialize_pressure_exchanger(m, optarg):
"flow_vol_phase",
"Liq",
): value( # same volumetric flow rate as PXR high pressure inlet
m.fs.PXR.high_pressure_side.properties_in[0].flow_vol_phase["Liq"]
m.fs.PXR.brine_side.properties_in[0].flow_vol_phase["Liq"]
),
("mass_frac_phase_comp", ("Liq", "NaCl")): value(
m.fs.S1.mixed_state[0].mass_frac_phase_comp["Liq", "NaCl"]
Expand Down Expand Up @@ -627,12 +623,12 @@ def print_state(s, b):
print_state("Split 1 ", m.fs.S1.P1)
print_state("P1 out ", m.fs.P1.outlet)
print_state("Split 2 ", m.fs.S1.PXR)
print_state("PXR LP out", m.fs.PXR.low_pressure_outlet)
print_state("PXR feed out", m.fs.PXR.feed_outlet)
print_state("P2 out ", m.fs.P2.outlet)
print_state("Mix out ", m.fs.M1.outlet)
print_state("RO perm ", m.fs.RO.permeate)
print_state("RO reten ", m.fs.RO.retentate)
print_state("PXR HP out", m.fs.PXR.high_pressure_outlet)
print_state("PXR brine out", m.fs.PXR.brine_outlet)


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,32 +61,32 @@ fs.P2.costing.capital_cost: 610.4424522403153
fs.P2.ratioP[0.0]: 1.0725115194945298
fs.P2.work_fluid[0.0]: 255.95071372759554
fs.PXR.costing.capital_cost: 973.1020678190223
fs.PXR.high_pressure_side.deltaP[0.0]: -7247342.029398318
fs.PXR.high_pressure_side.properties_in[0.0].dens_mass_phase[Liq]: 1045.9125190112295
fs.PXR.high_pressure_side.properties_in[0.0].flow_mass_phase_comp[Liq,H2O]: 0.49285444999999994
fs.PXR.high_pressure_side.properties_in[0.0].flow_mass_phase_comp[Liq,NaCl]: 0.035587728093265734
fs.PXR.high_pressure_side.properties_in[0.0].flow_vol_phase[Liq]: 0.0005052451027097726
fs.PXR.high_pressure_side.properties_in[0.0].mass_frac_phase_comp[Liq,H2O]: 0.9326553981332943
fs.PXR.high_pressure_side.properties_in[0.0].mass_frac_phase_comp[Liq,NaCl]: 0.06734460186670563
fs.PXR.high_pressure_side.properties_in[0.0].pressure: 7348667.029398319
fs.PXR.high_pressure_side.properties_in[0.0].temperature: 298.1500072638073
fs.PXR.high_pressure_side.properties_out[0.0].flow_mass_phase_comp[Liq,H2O]: 0.49285444999999994
fs.PXR.high_pressure_side.properties_out[0.0].flow_mass_phase_comp[Liq,NaCl]: 0.035587728093265734
fs.PXR.high_pressure_side.properties_out[0.0].pressure: 101325.0
fs.PXR.high_pressure_side.properties_out[0.0].temperature: 298.1500072638073
fs.PXR.low_pressure_side.deltaP[0.0]: 6884974.927928402
fs.PXR.low_pressure_side.properties_in[0.0].dens_mass_phase[Liq]: 1021.46
fs.PXR.low_pressure_side.properties_in[0.0].flow_mass_phase_comp[Liq,H2O]: 0.498024594422437
fs.PXR.low_pressure_side.properties_in[0.0].flow_mass_phase_comp[Liq,NaCl]: 0.018063068191487355
fs.PXR.low_pressure_side.properties_in[0.0].flow_vol_phase[Liq]: 0.0005052451027097726
fs.PXR.low_pressure_side.properties_in[0.0].mass_frac_phase_comp[Liq,H2O]: 0.965
fs.PXR.low_pressure_side.properties_in[0.0].mass_frac_phase_comp[Liq,NaCl]: 0.03500000000000001
fs.PXR.low_pressure_side.properties_in[0.0].pressure: 101325.0
fs.PXR.low_pressure_side.properties_in[0.0].temperature: 298.15
fs.PXR.low_pressure_side.properties_out[0.0].flow_mass_phase_comp[Liq,H2O]: 0.498024594422437
fs.PXR.low_pressure_side.properties_out[0.0].flow_mass_phase_comp[Liq,NaCl]: 0.018063068191487355
fs.PXR.low_pressure_side.properties_out[0.0].pressure: 6986299.927928403
fs.PXR.low_pressure_side.properties_out[0.0].temperature: 298.15
fs.PXR.brine_side.deltaP[0.0]: -7247342.029398318
fs.PXR.brine_side.properties_in[0.0].dens_mass_phase[Liq]: 1045.9125190112295
fs.PXR.brine_side.properties_in[0.0].flow_mass_phase_comp[Liq,H2O]: 0.49285444999999994
fs.PXR.brine_side.properties_in[0.0].flow_mass_phase_comp[Liq,NaCl]: 0.035587728093265734
fs.PXR.brine_side.properties_in[0.0].flow_vol_phase[Liq]: 0.0005052451027097726
fs.PXR.brine_side.properties_in[0.0].mass_frac_phase_comp[Liq,H2O]: 0.9326553981332943
fs.PXR.brine_side.properties_in[0.0].mass_frac_phase_comp[Liq,NaCl]: 0.06734460186670563
fs.PXR.brine_side.properties_in[0.0].pressure: 7348667.029398319
fs.PXR.brine_side.properties_in[0.0].temperature: 298.1500072638073
fs.PXR.brine_side.properties_out[0.0].flow_mass_phase_comp[Liq,H2O]: 0.49285444999999994
fs.PXR.brine_side.properties_out[0.0].flow_mass_phase_comp[Liq,NaCl]: 0.035587728093265734
fs.PXR.brine_side.properties_out[0.0].pressure: 101325.0
fs.PXR.brine_side.properties_out[0.0].temperature: 298.1500072638073
fs.PXR.feed_side.deltaP[0.0]: 6884974.927928402
fs.PXR.feed_side.properties_in[0.0].dens_mass_phase[Liq]: 1021.46
fs.PXR.feed_side.properties_in[0.0].flow_mass_phase_comp[Liq,H2O]: 0.498024594422437
fs.PXR.feed_side.properties_in[0.0].flow_mass_phase_comp[Liq,NaCl]: 0.018063068191487355
fs.PXR.feed_side.properties_in[0.0].flow_vol_phase[Liq]: 0.0005052451027097726
fs.PXR.feed_side.properties_in[0.0].mass_frac_phase_comp[Liq,H2O]: 0.965
fs.PXR.feed_side.properties_in[0.0].mass_frac_phase_comp[Liq,NaCl]: 0.03500000000000001
fs.PXR.feed_side.properties_in[0.0].pressure: 101325.0
fs.PXR.feed_side.properties_in[0.0].temperature: 298.15
fs.PXR.feed_side.properties_out[0.0].flow_mass_phase_comp[Liq,H2O]: 0.498024594422437
fs.PXR.feed_side.properties_out[0.0].flow_mass_phase_comp[Liq,NaCl]: 0.018063068191487355
fs.PXR.feed_side.properties_out[0.0].pressure: 6986299.927928403
fs.PXR.feed_side.properties_out[0.0].temperature: 298.15
fs.RO.feed_side.K[0.0,0.0,NaCl]: 3.4512803512388215e-05
fs.RO.feed_side.K[0.0,1.0,NaCl]: 2.7060824531310153e-05
fs.RO.feed_side.N_Re[0.0,0.0]: 339.4894225951861
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ def test_build(self, system_frame):
fs.s03: (fs.P1.outlet, fs.M1.P1),
fs.s04: (fs.M1.outlet, fs.RO.inlet),
fs.s05: (fs.RO.permeate, fs.product.inlet),
fs.s06: (fs.RO.retentate, fs.PXR.high_pressure_inlet),
fs.s07: (fs.PXR.high_pressure_outlet, fs.disposal.inlet),
fs.s08: (fs.S1.PXR, fs.PXR.low_pressure_inlet),
fs.s09: (fs.PXR.low_pressure_outlet, fs.P2.inlet),
fs.s06: (fs.RO.retentate, fs.PXR.brine_inlet),
fs.s07: (fs.PXR.brine_outlet, fs.disposal.inlet),
fs.s08: (fs.S1.PXR, fs.PXR.feed_inlet),
fs.s09: (fs.PXR.feed_outlet, fs.P2.inlet),
fs.s10: (fs.P2.outlet, fs.M1.P2),
}
for arc, port_tpl in arc_dict.items():
Expand Down Expand Up @@ -197,32 +197,30 @@ def test_initialize_system(self, system_frame):
# check results across pressure exchanger, proxy for both upstream and downstream of RO
# high pressure inlet
assert value(
m.fs.PXR.high_pressure_inlet.flow_mass_phase_comp[0, "Liq", "H2O"]
m.fs.PXR.brine_inlet.flow_mass_phase_comp[0, "Liq", "H2O"]
) == pytest.approx(0.4928, rel=1e-3)
assert value(
m.fs.PXR.high_pressure_inlet.flow_mass_phase_comp[0, "Liq", "NaCl"]
m.fs.PXR.brine_inlet.flow_mass_phase_comp[0, "Liq", "NaCl"]
) == pytest.approx(3.561e-2, rel=1e-3)
assert value(m.fs.PXR.high_pressure_inlet.temperature[0]) == pytest.approx(
assert value(m.fs.PXR.brine_inlet.temperature[0]) == pytest.approx(
298.15, rel=1e-3
)
assert value(m.fs.PXR.high_pressure_inlet.pressure[0]) == pytest.approx(
assert value(m.fs.PXR.brine_inlet.pressure[0]) == pytest.approx(
7.242e6, rel=1e-3
)
# low pressure inlet
assert value(
m.fs.PXR.low_pressure_inlet.flow_mass_phase_comp[0, "Liq", "H2O"]
m.fs.PXR.feed_inlet.flow_mass_phase_comp[0, "Liq", "H2O"]
) == pytest.approx(0.4980, rel=1e-3)
assert value(
m.fs.PXR.low_pressure_inlet.flow_mass_phase_comp[0, "Liq", "NaCl"]
m.fs.PXR.feed_inlet.flow_mass_phase_comp[0, "Liq", "NaCl"]
) == pytest.approx(1.806e-2, rel=1e-3)
assert value(m.fs.PXR.low_pressure_inlet.temperature[0]) == pytest.approx(
assert value(m.fs.PXR.feed_inlet.temperature[0]) == pytest.approx(
298.15, rel=1e-3
)
assert value(m.fs.PXR.low_pressure_inlet.pressure[0]) == pytest.approx(
101325, rel=1e-3
)
assert value(m.fs.PXR.feed_inlet.pressure[0]) == pytest.approx(101325, rel=1e-3)
# low pressure outlet
assert value(m.fs.PXR.low_pressure_outlet.pressure[0]) == pytest.approx(
assert value(m.fs.PXR.feed_outlet.pressure[0]) == pytest.approx(
6.885e6, rel=1e-3
)

Expand Down Expand Up @@ -310,12 +308,12 @@ def test_display_state(self, system_frame, capsys):
Split 1 : 0.505 kg/s, 35000 ppm, 1.0 bar
P1 out : 0.505 kg/s, 35000 ppm, 74.9 bar
Split 2 : 0.516 kg/s, 35000 ppm, 1.0 bar
PXR LP out: 0.516 kg/s, 35000 ppm, 68.9 bar
PXR feed out: 0.516 kg/s, 35000 ppm, 68.9 bar
P2 out : 0.516 kg/s, 35000 ppm, 74.9 bar
Mix out : 1.021 kg/s, 35000 ppm, 74.9 bar
RO perm : 0.493 kg/s, 240 ppm, 1.0 bar
RO reten : 0.528 kg/s, 67424 ppm, 72.4 bar
PXR HP out: 0.528 kg/s, 67424 ppm, 1.0 bar
PXR brine out: 0.528 kg/s, 67424 ppm, 1.0 bar
"""
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,16 +288,12 @@ def eq_flow_mass_comp(blk, j): # pylint: disable=function-redefined
desal.s01 = Arc(source=desal.S1.P1, destination=desal.P1.inlet)
desal.s02 = Arc(source=desal.P1.outlet, destination=desal.M1.P1)
desal.s03 = Arc(source=desal.M1.outlet, destination=desal.RO.inlet)
desal.s04 = Arc(
source=desal.RO.retentate, destination=desal.PXR.high_pressure_inlet
)
desal.s05 = Arc(source=desal.S1.PXR, destination=desal.PXR.low_pressure_inlet)
desal.s06 = Arc(
source=desal.PXR.low_pressure_outlet, destination=desal.P2.inlet
)
desal.s04 = Arc(source=desal.RO.retentate, destination=desal.PXR.brine_inlet)
desal.s05 = Arc(source=desal.S1.PXR, destination=desal.PXR.feed_inlet)
desal.s06 = Arc(source=desal.PXR.feed_outlet, destination=desal.P2.inlet)
desal.s07 = Arc(source=desal.P2.outlet, destination=desal.M1.P2)
m.fs.s_disposal = Arc(
source=desal.PXR.high_pressure_outlet, destination=m.fs.disposal.inlet
source=desal.PXR.brine_outlet, destination=m.fs.disposal.inlet
)
elif erd_type == "pump_as_turbine":
m.fs.s_tb_desal = Arc(
Expand Down Expand Up @@ -343,8 +339,8 @@ def eq_flow_mass_comp(blk, j): # pylint: disable=function-redefined
iscale.set_scaling_factor(desal.RO.area, 1e-4)
if erd_type == "pressure_exchanger":
iscale.set_scaling_factor(desal.P2.control_volume.work, 1e-5)
iscale.set_scaling_factor(desal.PXR.low_pressure_side.work, 1e-5)
iscale.set_scaling_factor(desal.PXR.high_pressure_side.work, 1e-5)
iscale.set_scaling_factor(desal.PXR.feed_side.work, 1e-5)
iscale.set_scaling_factor(desal.PXR.brine_side.work, 1e-5)
elif erd_type == "pump_as_turbine":
iscale.set_scaling_factor(desal.ERD.control_volume.work, 1e-5)
# calculate and propagate scaling factors
Expand Down
Loading
Loading