Skip to content

Commit

Permalink
Add properties and minor fixes for property sets (#1230)
Browse files Browse the repository at this point in the history
* Update property set and checkes

* Add saturation index

* Add ionic strength

* Run black

* Pylint fixes

* Revert pytest.ini

* Fix index check

* Revert pytest.ini

* Move properties to electrolyte

* Move saturation index

* Fix tests

* Fix pylint errors

* Add act_coeff

* Fix a couple properties

* Add Prandtl number

* Fix pylint errors
  • Loading branch information
John Eslick authored Aug 4, 2023
1 parent 3880c2c commit deacf4c
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 96 deletions.
18 changes: 17 additions & 1 deletion idaes/core/base/property_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def define_metadata(cls, meta):

from pyomo.environ import units
from pyomo.core.base.units_container import _PyomoUnit, InconsistentUnitsError
from pyomo.common.deprecation import deprecation_warning

from idaes.core.util.exceptions import PropertyPackageError
from idaes.core.base.property_set import StandardPropertySet, PropertySetBase
Expand Down Expand Up @@ -519,7 +520,22 @@ def add_properties(self, p: dict):
for k, v in p.items():
units = v.pop("units", None)
try:
n, i = self._properties.get_name_and_index(k)
try:
n, i = self._properties.get_name_and_index(k)
except ValueError:
msg = (
f"The property name {k} in property metadata is not a recognized "
"standard property name defined in this PropertySet. Please refer "
"to IDAES standard names in the IDAES documentation. You can use "
"the define_custom_properties() rather than the add_properties() "
"method to define metadata for this property. You can also use a "
"different property set by calling the define_property_set() method."
)
deprecation_warning(
msg=msg, logger=_log, version="2.0.0", remove_in="3.0.0"
)
n = k
i = None
getattr(self._properties, n)[i].update_property(**v)
except AttributeError:
# TODO: Deprecate this and make it raise an exception if an unknown property is encountered
Expand Down
Loading

0 comments on commit deacf4c

Please sign in to comment.