#####################################################################################################
# “PrOMMiS” was produced under the DOE Process Optimization and Modeling for Minerals Sustainability
# (“PrOMMiS”) initiative, and is copyright (c) 2023-2026 by the software owners: The Regents of the
# University of California, through Lawrence Berkeley National Laboratory, et al. All rights reserved.
# Please see the files COPYRIGHT.md and LICENSE.md for full copyright and license information.
#####################################################################################################
"""
Property package for the inlet and outlet streams of the multi-component diafiltration membrane.
Author: Molly Dougher
"""
from pyomo.common.config import ConfigValue, ListOf
from pyomo.environ import Set, Var, units
from idaes.core import (
MaterialFlowBasis,
Phase,
PhysicalParameterBlock,
StateBlock,
StateBlockData,
declare_process_block_class,
)
from idaes.core.util.exceptions import ConfigurationError
from idaes.core.util.initialization import fix_state_vars
[docs]
@declare_process_block_class("MultiComponentDiafiltrationStreamParameter")
class MultiComponentDiafiltrationStreamParameterData(PhysicalParameterBlock):
"""
Property Package for the feed and product streams in the multi-component
diafiltration membrane.
Currently includes the following solutes:
Li (lithium ion, +)
Co (cobalt ion, 2+)
Al (aluminum ion, 3+)
Cl (chloride ion, -)
"""
CONFIG = PhysicalParameterBlock.CONFIG()
CONFIG.declare(
"cation_list",
ConfigValue(
domain=ListOf(str),
default=["Li", "Co"],
doc="List of cations present in the system",
),
)
CONFIG.declare(
"anion_list",
ConfigValue(
domain=ListOf(str),
default=["Cl"],
doc="List of anions present in the system",
),
)
[docs]
def build(self):
super().build()
if len(self.config.anion_list) > 1:
raise ConfigurationError(
"The multi-component diafiltration unit model only supports systems with a common anion"
)
self.liquid = Phase()
self.component_list = Set(
initialize=self.config.cation_list + self.config.anion_list
)
self._state_block_class = MultiComponentDiafiltrationStreamStateBlock
class _MultiComponentDiafiltrationStreamStateBlock(StateBlock):
def fix_initialization_states(self):
"""
Fixes state variables for state blocks.
Returns:
None
"""
fix_state_vars(self)
[docs]
@declare_process_block_class(
"MultiComponentDiafiltrationStreamStateBlock",
block_class=_MultiComponentDiafiltrationStreamStateBlock,
)
class MultiComponentDiafiltrationStreamStateBlockData(StateBlockData):
"""
State block for the feed and product streams in the multi-component
diafiltration membrane.
"""
[docs]
def build(self):
super().build()
self.flow_vol = Var(
units=units.m**3 / units.h,
initialize=10,
bounds=(1e-20, None),
)
self.conc_mol_comp = Var(
self.component_list,
units=units.mol / units.m**3,
initialize=1e-5,
bounds=(1e-20, None),
)
[docs]
def get_material_flow_terms(self, p, j):
return self.flow_vol * self.conc_mol_comp[j]
[docs]
def get_material_flow_basis(self):
return MaterialFlowBasis.mole
[docs]
def define_state_vars(self):
return {"flow_vol": self.flow_vol, "conc_mol_comp": self.conc_mol_comp}