Skip to content

Commit

Permalink
Deprecation tests and update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dallan-keylogic committed Nov 4, 2024
1 parent 36c98b8 commit a37274a
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Cubic Equations of State
========================

.. deprecated:: 2.7
Use `idaes.models.properties.modular_properties.eos.ceos` in the Modular Property Framework instead.

This property package implements a general form of a cubic equation of state which can be used for most cubic-type equations of state. This package supports phase equilibrium calculations with a smooth phase transition formulation that makes it amenable for equation oriented optimization. The following equations of state are currently supported:

* Peng-Robinson
Expand Down
8 changes: 7 additions & 1 deletion idaes/models/properties/cubic_eos/BT_PR.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"""
# Import Pyomo libraries
from pyomo.environ import Reals, Param, NonNegativeReals, Set, units as pyunits
from pyomo.common.deprecation import deprecated

# Import IDAES cores
from idaes.core import declare_process_block_class, Component
Expand All @@ -35,7 +36,12 @@
# Set up logger
_log = getIdaesLogger(__name__)


@deprecated(
msg="The standalone cubic property package has been deprecated in favor of the "
"cubic equation of state for the modular property framework. This class will be "
"removed in the May 2025 release.",
version="2.7.0",
)
@declare_process_block_class("BTParameterBlock")
class BTParameterData(CubicParameterData):
"""Cubic property package for benzene and toluene mixtures."""
Expand Down
14 changes: 7 additions & 7 deletions idaes/models/properties/cubic_eos/cubic_prop_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@
@deprecated(
msg="The standalone cubic property package has been deprecated in favor of the "
"cubic equation of state for the modular property framework. This class will be "
"removed in the next release.",
version="2.6.0",
"removed in the May 2025 release.",
version="2.7.0",
)
@declare_process_block_class("CubicParameterBlock")
class CubicParameterData(PhysicalParameterBlock):
Expand Down Expand Up @@ -230,8 +230,8 @@ def define_metadata(cls, obj):
@deprecated(
msg="The standalone cubic property package has been deprecated in favor of the "
"cubic equation of state for the modular property framework. This class will be "
"removed in the next release.",
version="2.6.0",
"removed in the May 2025 release.",
version="2.7.0",
)
class CubicEoSInitializer(InitializerBase):
"""
Expand Down Expand Up @@ -653,8 +653,8 @@ def antoine_P(b, j, T):
@deprecated(
msg="The standalone cubic property package has been deprecated in favor of the "
"cubic equation of state for the modular property framework. This class will be "
"removed in the next release.",
version="2.6.0",
"removed in the May 2025 release.",
version="2.7.0",
)
class _CubicStateBlock(StateBlock):
"""
Expand Down Expand Up @@ -1115,7 +1115,7 @@ def release_state(blk, flags, outlvl=idaeslog.NOTSET):
msg="The standalone cubic property package has been deprecated in favor of the "
"cubic equation of state for the modular property framework. This class will be "
"removed in the next release.",
version="2.6.0",
version="2.7.0",
)
@declare_process_block_class("CubicStateBlock", block_class=_CubicStateBlock)
class CubicStateBlockData(StateBlockData):
Expand Down
12 changes: 9 additions & 3 deletions idaes/models/properties/cubic_eos/tests/test_BT_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
)
from pyomo.util.check_units import assert_units_consistent

import idaes.logger as idaeslog
from idaes.models.properties.tests.test_harness import PropertyTestHarness
from idaes.core.solvers import get_solver

Expand Down Expand Up @@ -76,12 +77,17 @@ def configure(self):
@pytest.mark.skipif(not prop_available, reason="Cubic root finder not available")
class TestBTExample(object):
@pytest.mark.component
def test_units(self):
def test_units(self, caplog):
m = ConcreteModel()

m.fs = FlowsheetBlock(dynamic=False)

with caplog.at_level(idaeslog.WARNING):
m.fs.props = BT_PR.BTParameterBlock(valid_phase=("Vap", "Liq"))
assert (
"May 2025 release." in caplog.text
)


m.fs.props = BT_PR.BTParameterBlock(valid_phase=("Vap", "Liq"))

m.fs.state = m.fs.props.build_state_block([0], defined_state=True)

Expand Down
26 changes: 19 additions & 7 deletions idaes/models/properties/cubic_eos/tests/test_cubic_prop_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
)

from idaes.core import FlowsheetBlock, Component
import idaes.logger as idaeslog
from idaes.models.properties.cubic_eos.cubic_prop_pack import (
CubicParameterBlock,
CubicStateBlock,
Expand Down Expand Up @@ -51,12 +52,15 @@ class TestParameterBlock(object):
not cubic_roots_available(), reason="Cubic functions not available"
)
@pytest.mark.unit
def test_build_default(self):
def test_build_default(self, caplog):
m = ConcreteModel()

m.fs = FlowsheetBlock(dynamic=False)

m.fs.params = CubicParameterBlock()
with caplog.at_level(idaeslog.WARNING):
m.fs.params = CubicParameterBlock()
assert (
"May 2025 release." in caplog.text
)

assert m.fs.params.state_block_class is CubicStateBlock
assert m.fs.params.config.valid_phase == ("Vap", "Liq")
Expand Down Expand Up @@ -187,8 +191,12 @@ def model(self):
not cubic_roots_available(), reason="Cubic functions not available"
)
@pytest.mark.unit
def test_build_default(self, model):
model.fs.props = model.fs.params.build_state_block([1])
def test_build_default(self, model, caplog):
with caplog.at_level(idaeslog.WARNING):
model.fs.props = model.fs.params.build_state_block([1])
assert (
"May 2025 release." in caplog.text
)

assert model.fs.props.default_initializer is CubicEoSInitializer

Expand Down Expand Up @@ -510,8 +518,12 @@ def model(self):
not cubic_roots_available(), reason="Cubic functions not available"
)
@pytest.mark.unit
def test_build_default(self, model):
model.fs.props = model.fs.params.build_state_block([1])
def test_build_default(self, model, caplog):
with caplog.at_level(idaeslog.WARNING):
model.fs.props = model.fs.params.build_state_block([1])
assert (
"May 2025 release." in caplog.text
)

assert isinstance(model.fs.props[1].flow_mol, Var)
assert len(model.fs.props[1].flow_mol) == 1
Expand Down

0 comments on commit a37274a

Please sign in to comment.