Giter Club home page Giter Club logo

examples-pse's People

Contributors

adam-a-a avatar adowling2 avatar agarciadiego avatar alexnoring avatar andrewlee94 avatar anujad95 avatar blnicho avatar bpaul4 avatar chineduobiora avatar dallan-keylogic avatar dangunter avatar dependabot[bot] avatar jsiirola avatar kaklise avatar ksbeattie avatar lbianchi-lbl avatar makaylas avatar marcusholly avatar mazamarripa avatar menglecmu avatar ooamusat avatar perrenyang avatar radhakrishnatg avatar viiibhav avatar xiangyuy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

examples-pse's Issues

Build error for notebook Examples/Flowsheets/HDA_flowsheet_with_distillation_solution_testing.ipynb

The following error occurred when building the full set of examples in preparation for the 1.11.0rc0 release:

2021-08-25 20:10:56,659 INFO - [Worker 0] Convert notebook name=/home/lbianchi/idaes/examples-pse/src/Examples/Flowsheets/HDA_flowsheet_with_distillation_solution_testing.ipynb: begin
2021-08-25 20:10:56,659 INFO - [Worker 0] Converting: HDA_flowsheet_with_distillation_solution_testing.ipynb
2021-08-25 20:10:56,906 INFO - [Worker 0] Stripped tags from: HDA_flowsheet_with_distillation_solution_testing.ipynb
2021-08-25 20:10:56,906 INFO - [Worker 0] Running notebook: HDA_flowsheet_with_distillation_solution.ipynb
2021-08-25 20:10:58,679 ERROR - [Worker 0] Notebook execution failed: execution error for '/tmp/tmpzahzi5y0/HDA_flowsheet_with_distillation_solution.ipynb': An error occurred while executing the following cell:
------------------
import hda_reaction_kinetic as reaction_props
from idaes.generic_models.properties.activity_coeff_models.\
    BTX_activity_coeff_VLE import BTXParameterBlock

# Add the folder containing the thermodynamic package to the system path
import sys 
sys.path.insert(0, '../..')

from Tutorials.Basics.hda_ideal_VLE import HDAParameterBlock
------------------

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
/tmp/ipykernel_20539/3355508218.py in <module>
      7 sys.path.insert(0, '../..')
      8 
----> 9 from Tutorials.Basics.hda_ideal_VLE import HDAParameterBlock

ModuleNotFoundError: No module named 'Tutorials'
ModuleNotFoundError: No module named 'Tutorials'

2021-08-25 20:10:58,679 ERROR - [Worker 0] Execution failed: generating partial output for '/home/lbianchi/idaes/examples-pse/src/Examples/Flowsheets/HDA_flowsheet_with_distillation_solution_testing.ipynb'
2021-08-25 20:10:58,679 INFO - [Worker 0] Convert notebook name=/home/lbianchi/idaes/examples-pse/src/Examples/Flowsheets/HDA_flowsheet_with_distillation_solution_testing.ipynb: end, ok=False duration=2.0s

The likely cause for this is the sys.path.insert(0, '../../') used to import packages into the notebook. Manipulating sys.path in this fashion should be avoided in general, and in particular when used for IDAES examples notebooks since it's almost guaranteed not to work.

Build error with examples-pse 1.9.0rc0 in notebook Examples/SurrMod/ALAMO/ALAMO_six_hump_camel.ipynb

Notebook cell where the error occurs:

hasBaron = False
try:
    solver_opt = pyo.SolverFactory('baron')
    hasBaron = solver_opt.available()
except ApplicationError as err:
    print("Partial test completed. %s"%err)


if alamo_ran and hasBaron:
    model = pyo.ConcreteModel()
    opt = pyo.SolverFactory('baron')
    model.x1 = pyo.Var()
    model.x2 = pyo.Var()
    def pyomo_model(model):
        import z1
        return z1.f(model.x1,model.x2)
    model.obj = pyo.Objective(rule = pyomo_model)
    results = opt.solve(model)
    model.solutions.store_to(results)
    print(results)

Traceback:

ValueError                                Traceback (most recent call last)
<ipython-input-1-b0dff88c0fa0> in <module>
     17     model.obj = pyo.Objective(rule = pyomo_model)
     18     results = opt.solve(model)
---> 19     model.solutions.store_to(results)
     20     print(results)

~/anaconda3/envs/examples-rel/lib/python3.7/site-packages/pyomo/core/base/PyomoModel.py in store_to(self, results, cuid, skip_stale_vars)
    322                 else:
    323                     vals = vals[1]
--> 324                 vals['Value'] = value(obj)
    325                 soln.variable[ sm.getSymbol(obj, labeler) ] = vals
    326             entry = soln_._entry['constraint']

pyomo/core/expr/numvalue.pyx in pyomo.core.expr.numvalue.value()

pyomo/core/expr/numvalue.pyx in pyomo.core.expr.numvalue.value()

ValueError: No value for uninitialized NumericValue object x1
ValueError: No value for uninitialized NumericValue object x1

More failures in example notebooks

The recent merge of IDAES/idaes-pse#627 has revealed additional issues with the HDS flowsheet example (Examples/Flowsheets/HDA_flowsheet_with_distillation_solution_testing.ipynb). It appears the reactor initialization step is/was failing and that it had not been noticed up until now - now that the CSTR initialization routine raises an InitializationError if the final solve fails to converge this notebook is now failing.

We need to look at this model once again and determine what the issue is and try to improve the models performance (hopefully through scaling). As an absolute last resort, we can wrap the CSTR initialization step in a try/except statement to skip the error, but that should be avoided as this is our flagship tutorial example.

DMF example(s) fail with NameError: name 'dmf_params' is not defined

See e.g. https://github.com/IDAES/idaes-pse/runs/7198611013?check_suite_focus=true

 ------------------
# save to DMF
# create resources
name = "BT NRTL est param1"
ds_s1 = _dmf.find_one(name=name)
if not ds_s1:
    ds_s1 = _dmf.new(name=name, desc="Solution for data subset 1", data={'SSE': obj_value_1, 'parameters': 
                                                                         {'tau': {'benzene,toluene': dmf_params["1:bt"],
                                                                                  'toluene,benzene': dmf_params["1:tb"]}}})
    create_relation(ds_s1, Predicates.derived, ds_splits[0])
name = "BT NRTL est param2"
ds_s2 = _dmf.find_one(name=name)
if not ds_s2:
    ds_s2 = _dmf.new(name=name, desc="Solution for data subset 2", data={'SSE': obj_value_2, 'parameters': 
                                                                         {'tau': {'benzene,toluene': dmf_params["2:bt"],
                                                                                  'toluene,benzene': dmf_params["2:tb"]}}})
    create_relation(ds_s2, Predicates.derived, ds_splits[1])
# save relations (prints number of objects processed)
_dmf.update()
------------------
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
/tmp/ipykernel_5112/4039786833.py in <cell line: 5>()
      5ifnotds_s1:
      6     ds_s1 = _dmf.new(name=name, desc="Solution for data subset 1", data={'SSE': obj_value_1, 'parameters': 
----> 7                                                                          {'tau': {'benzene,toluene': dmf_params["1:bt"],
      8                                                                                   'toluene,benzene': dmf_params["1:tb"]}}})
      9create_relation(ds_s1,Predicates.derived,ds_splits[0])
NameError: name 'dmf_params' is not defined

Looking at recent commits, it seems eb4d22d might be related with this error; more specifically, moving the definition of dmf_params to a cell having the testing and/or remove_cell tags, which causes it to be undefined when the cell is removed during certain modes of programmatic execution such as the one used for the idaes-pse "Run notebooks" CI checks.

Local failures in test_vle

Running on Windows, on a clean install of requirements-dev ,

pytest -m component idaes\generic_models\properties\core\generic\tests\

I am seeing some errors in the test_vle module:

=========================================================================== FAILURES ============================================================================
________________________________________________________________ TestNoHenryComps.test_solve_vle ________________________________________________________________

self = <idaes.generic_models.properties.core.generic.tests.test_vle.TestNoHenryComps object at 0x000002A1617F9EB0>
model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x000002A161829040>

    @pytest.mark.component
    def test_solve_vle(self, model):
        results = solver.solve(model)

        # Check for optimal solution
        assert results.solver.termination_condition == \
            TerminationCondition.optimal
        assert results.solver.status == SolverStatus.ok

        assert pytest.approx(365.35, abs=0.01) == value(
            model.props[1].temperature_bubble[("Vap", "Liq")])
        assert pytest.approx(0.7137, abs=1e-4) == value(
            model.props[1]._mole_frac_tbub[("Vap", "Liq", "A")])
        assert pytest.approx(0.2863, abs=1e-4) == value(
            model.props[1]._mole_frac_tbub[("Vap", "Liq", "B")])

        assert pytest.approx(372.02, abs=0.01) == value(
            model.props[1].temperature_dew[("Vap", "Liq")])
        assert pytest.approx(0.2909, abs=1e-4) == value(
            model.props[1]._mole_frac_tdew[("Vap", "Liq", "A")])
        assert pytest.approx(0.7091, abs=1e-4) == value(
            model.props[1]._mole_frac_tdew[("Vap", "Liq", "B")])

>       assert pytest.approx(109479, abs=1) == value(
            model.props[1].pressure_bubble[("Vap", "Liq")])

idaes\generic_models\properties\core\generic\tests\test_vle.py:258:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

obj = <pyomo.core.base.var._GeneralVarData object at 0x000002A1619945E0>, exception = True

    def value(obj, exception=True):
        """
        A utility function that returns the value of a Pyomo object or
        expression.

        Args:
            obj: The argument to evaluate. If it is None, a
                string, or any other primative numeric type,
                then this function simply returns the argument.
                Otherwise, if the argument is a NumericValue
                then the __call__ method is executed.
            exception (bool): If :const:`True`, then an exception should
                be raised when instances of NumericValue fail to
                evaluate due to one or more objects not being
                initialized to a numeric value (e.g, one or more
                variables in an algebraic expression having the
                value None). If :const:`False`, then the function
                returns :const:`None` when an exception occurs.
                Default is True.

        Returns: A numeric value or None.
        """
        if obj.__class__ in native_types:
            return obj
        if obj.__class__ in pyomo_constant_types:
            #
            # I'm commenting this out for now, but I think we should never expect
            # to see a numeric constant with value None.
            #
            #if exception and obj.value is None:
            #    raise ValueError(
            #        "No value for uninitialized NumericConstant object %s"
            #        % (obj.name,))
            return obj.value
        #
        # Test if we have a duck types for Pyomo expressions
        #
        try:
            obj.is_expression_type()
        except AttributeError:
            #
            # If not, then try to coerce this into a numeric constant.  If that
            # works, then return the object
            #
            try:
                check_if_numeric_type_and_cache(obj)
                return obj
            except:
                raise TypeError(
                    "Cannot evaluate object with unknown type: %s" %
                    (type(obj).__name__,))
        #
        # Evaluate the expression object
        #
        if exception:
            #
            # Here, we try to catch the exception
            #

            try:
                tmp = obj(exception=True)
                if tmp is None:
>                   raise ValueError(
                        "No value for uninitialized NumericValue object %s"
                        % (obj.name,))
E                       ValueError: No value for uninitialized NumericValue object props[1].pressure_bubble[Vap,Liq]

..\..\..\..\miniconda3\envs\idaes-fv\lib\site-packages\pyomo\core\expr\numvalue.py:143: ValueError
----------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------
ERROR    pyomo.core:numvalue.py:153 evaluating object as numeric value: props[1].pressure_bubble[Vap,Liq]
    (object: <class 'pyomo.core.base.var._GeneralVarData'>)
No value for uninitialized NumericValue object props[1].pressure_bubble[Vap,Liq]
________________________________________________________________ TestHenryComps0.test_solve_vle _________________________________________________________________

self = <idaes.generic_models.properties.core.generic.tests.test_vle.TestHenryComps0 object at 0x000002A161C49B20>
model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x000002A161246F80>

    @pytest.mark.component
    def test_solve_vle(self, model):
        results = solver.solve(model)

        # Check for optimal solution
        assert results.solver.termination_condition == \
            TerminationCondition.optimal
        assert results.solver.status == SolverStatus.ok

        assert pytest.approx(365.35, abs=0.01) == value(
            model.props[1].temperature_bubble[("Vap", "Liq")])
        assert pytest.approx(0.7137, abs=1e-4) == value(
            model.props[1]._mole_frac_tbub[("Vap", "Liq", "A")])
        assert pytest.approx(0.2863, abs=1e-4) == value(
            model.props[1]._mole_frac_tbub[("Vap", "Liq", "B")])

        assert pytest.approx(372.02, abs=0.01) == value(
            model.props[1].temperature_dew[("Vap", "Liq")])
        assert pytest.approx(0.2909, abs=1e-4) == value(
            model.props[1]._mole_frac_tdew[("Vap", "Liq", "A")])
        assert pytest.approx(0.7091, abs=1e-4) == value(
            model.props[1]._mole_frac_tdew[("Vap", "Liq", "B")])

>       assert pytest.approx(109479, abs=1) == value(
            model.props[1].pressure_bubble[("Vap", "Liq")])

idaes\generic_models\properties\core\generic\tests\test_vle.py:504:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

obj = <pyomo.core.base.var._GeneralVarData object at 0x000002A161994EE0>, exception = True

    def value(obj, exception=True):
        """
        A utility function that returns the value of a Pyomo object or
        expression.

        Args:
            obj: The argument to evaluate. If it is None, a
                string, or any other primative numeric type,
                then this function simply returns the argument.
                Otherwise, if the argument is a NumericValue
                then the __call__ method is executed.
            exception (bool): If :const:`True`, then an exception should
                be raised when instances of NumericValue fail to
                evaluate due to one or more objects not being
                initialized to a numeric value (e.g, one or more
                variables in an algebraic expression having the
                value None). If :const:`False`, then the function
                returns :const:`None` when an exception occurs.
                Default is True.

        Returns: A numeric value or None.
        """
        if obj.__class__ in native_types:
            return obj
        if obj.__class__ in pyomo_constant_types:
            #
            # I'm commenting this out for now, but I think we should never expect
            # to see a numeric constant with value None.
            #
            #if exception and obj.value is None:
            #    raise ValueError(
            #        "No value for uninitialized NumericConstant object %s"
            #        % (obj.name,))
            return obj.value
        #
        # Test if we have a duck types for Pyomo expressions
        #
        try:
            obj.is_expression_type()
        except AttributeError:
            #
            # If not, then try to coerce this into a numeric constant.  If that
            # works, then return the object
            #
            try:
                check_if_numeric_type_and_cache(obj)
                return obj
            except:
                raise TypeError(
                    "Cannot evaluate object with unknown type: %s" %
                    (type(obj).__name__,))
        #
        # Evaluate the expression object
        #
        if exception:
            #
            # Here, we try to catch the exception
            #

            try:
                tmp = obj(exception=True)
                if tmp is None:
>                   raise ValueError(
                        "No value for uninitialized NumericValue object %s"
                        % (obj.name,))
E                       ValueError: No value for uninitialized NumericValue object props[1].pressure_bubble[Vap,Liq]

..\..\..\..\miniconda3\envs\idaes-fv\lib\site-packages\pyomo\core\expr\numvalue.py:143: ValueError
----------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------
ERROR    pyomo.core:numvalue.py:153 evaluating object as numeric value: props[1].pressure_bubble[Vap,Liq]
    (object: <class 'pyomo.core.base.var._GeneralVarData'>)
No value for uninitialized NumericValue object props[1].pressure_bubble[Vap,Liq]
_________________________________________________________________ TestHenryComps.test_solve_vle _________________________________________________________________

self = <idaes.generic_models.properties.core.generic.tests.test_vle.TestHenryComps object at 0x000002A161DAEC10>
model = <pyomo.core.base.PyomoModel.ConcreteModel object at 0x000002A161214B80>

    @pytest.mark.component
    def test_solve_vle(self, model):
        results = solver.solve(model)

        # Check for optimal solution
        assert results.solver.termination_condition == \
            TerminationCondition.optimal
        assert results.solver.status == SolverStatus.ok

        assert pytest.approx(361.50, abs=0.01) == value(
            model.props[1].temperature_bubble[("Vap", "Liq")])
        assert pytest.approx(0.5750, abs=1e-4) == value(
            model.props[1]._mole_frac_tbub[("Vap", "Liq", "A")])
        assert pytest.approx(0.2276, abs=1e-4) == value(
            model.props[1]._mole_frac_tbub[("Vap", "Liq", "B")])
        assert pytest.approx(0.1974, abs=1e-4) == value(
            model.props[1]._mole_frac_tbub[("Vap", "Liq", "C")])

        assert pytest.approx(370.23, abs=0.01) == value(
            model.props[1].temperature_dew[("Vap", "Liq")])
        assert pytest.approx(0.2750, abs=1e-4) == value(
            model.props[1]._mole_frac_tdew[("Vap", "Liq", "A")])
        assert pytest.approx(0.6744, abs=1e-4) == value(
            model.props[1]._mole_frac_tdew[("Vap", "Liq", "B")])
        assert pytest.approx(0.0506, abs=1e-4) == value(
            model.props[1]._mole_frac_tdew[("Vap", "Liq", "C")])

>       assert pytest.approx(118531, abs=1) == value(
            model.props[1].pressure_bubble[("Vap", "Liq")])

idaes\generic_models\properties\core\generic\tests\test_vle.py:661:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

obj = <pyomo.core.base.var._GeneralVarData object at 0x000002A161BC2FA0>, exception = True

    def value(obj, exception=True):
        """
        A utility function that returns the value of a Pyomo object or
        expression.

        Args:
            obj: The argument to evaluate. If it is None, a
                string, or any other primative numeric type,
                then this function simply returns the argument.
                Otherwise, if the argument is a NumericValue
                then the __call__ method is executed.
            exception (bool): If :const:`True`, then an exception should
                be raised when instances of NumericValue fail to
                evaluate due to one or more objects not being
                initialized to a numeric value (e.g, one or more
                variables in an algebraic expression having the
                value None). If :const:`False`, then the function
                returns :const:`None` when an exception occurs.
                Default is True.

        Returns: A numeric value or None.
        """
        if obj.__class__ in native_types:
            return obj
        if obj.__class__ in pyomo_constant_types:
            #
            # I'm commenting this out for now, but I think we should never expect
            # to see a numeric constant with value None.
            #
            #if exception and obj.value is None:
            #    raise ValueError(
            #        "No value for uninitialized NumericConstant object %s"
            #        % (obj.name,))
            return obj.value
        #
        # Test if we have a duck types for Pyomo expressions
        #
        try:
            obj.is_expression_type()
        except AttributeError:
            #
            # If not, then try to coerce this into a numeric constant.  If that
            # works, then return the object
            #
            try:
                check_if_numeric_type_and_cache(obj)
                return obj
            except:
                raise TypeError(
                    "Cannot evaluate object with unknown type: %s" %
                    (type(obj).__name__,))
        #
        # Evaluate the expression object
        #
        if exception:
            #
            # Here, we try to catch the exception
            #

            try:
                tmp = obj(exception=True)
                if tmp is None:
>                   raise ValueError(
                        "No value for uninitialized NumericValue object %s"
                        % (obj.name,))
E                       ValueError: No value for uninitialized NumericValue object props[1].pressure_bubble[Vap,Liq]

..\..\..\..\miniconda3\envs\idaes-fv\lib\site-packages\pyomo\core\expr\numvalue.py:143: ValueError
----------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------
ERROR    pyomo.core:numvalue.py:153 evaluating object as numeric value: props[1].pressure_bubble[Vap,Liq]
    (object: <class 'pyomo.core.base.var._GeneralVarData'>)
No value for uninitialized NumericValue object props[1].pressure_bubble[Vap,Liq]

Build error with examples-pse 1.8.0 in file Tutorials/Advanced/ParamEst/DMF_for_parameter_estimation_NRTL_using_unit_model_solution_testing.ipynb

2021-01-13 17:18:01,334 ERROR - [Worker 0] Notebook execution failed: execution error for '/tmp/tmpdz3kfiy4/DMF_for_parameter_estimation_NRTL_using_unit_model_solution.ipynb': An error occurred while executing the following cell:
------------------
# save to DMF
# create resources
name = "BT NRTL est param1"
ds_s1 = _dmf.find_one(name=name)
if not ds_s1:
    ds_s1 = _dmf.new(name=name, desc="Solution for data subset 1", data={'SSE': obj_value_1, 'parameters': 
                                                                         {'tau': {'benzene,toluene': parameters_1["fs.properties.tau[('benzene', 'toluene')]"],
                                                                                  'toluene,benzene': parameters_1["fs.properties.tau[('toluene', 'benzene')]"]}}})
    create_relation(ds_s1, Predicates.derived, ds_splits[0])
name = "BT NRTL est param2"
ds_s2 = _dmf.find_one(name=name)
if not ds_s2:
    ds_s2 = _dmf.new(name=name, desc="Solution for data subset 2", data={'SSE': obj_value_2, 'parameters': 
                                                                         {'tau': {'benzene,toluene': parameters_2["fs.properties.tau[('benzene', 'toluene')]"],
                                                                                  'toluene,benzene': parameters_2["fs.properties.tau[('toluene', 'benzene')]"]}}})

    create_relation(ds_s2, Predicates.derived, ds_splits[1])
# save relations (prints number of objects processed)
_dmf.update()
------------------

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-1-c0f0d12ae577> in <module>
      5 if not ds_s1:
      6     ds_s1 = _dmf.new(name=name, desc="Solution for data subset 1", data={'SSE': obj_value_1, 'parameters': 
----> 7                                                                          {'tau': {'benzene,toluene': parameters_1["fs.properties.tau[('benzene', 'toluene')]"],
      8                                                                                   'toluene,benzene': parameters_1["fs.properties.tau[('toluene', 'benzene')]"]}}})
      9     create_relation(ds_s1, Predicates.derived, ds_splits[0])

KeyError: "fs.properties.tau[('benzene', 'toluene')]"
KeyError: "fs.properties.tau[('benzene', 'toluene')]"

2021-01-13 17:18:01,334 ERROR - [Worker 0] Execution failed: generating partial output for '/home/lbianchi/idaes/examples-pse-rel/src/Tutorials/Advanced/ParamEst/DMF_for_parameter_estimation_NRTL_using_unit_model_solution_testing.ipynb'

Broken links in tutorial notebooks

There are broken links in our tutorial notebooks that point users to specific pages in our idaes-pse readthedocs documentation. We should fix the links and figure out a way to test if the links work to make it easier to detect this in the future. I'll update this issue with a list of all the broken links that need to be fixed.

Build error with examples-pse 1.8.0 in file Examples/SurrMod/ALAMO/ALAMO_six_hump_camel.ipynb

UPDATE: as in previous occurrences, this error did not occur again when running the build a second time using identical source files and environment.

2021-01-13 17:17:30,754 ERROR - [Worker 6] Notebook execution failed: execution error for '/tmp/tmpmisdckxa/ALAMO_six_hump_camel.ipynb': An error occurred while executing the following cell:
------------------
hasBaron = False
try:
    solver_opt = pyo.SolverFactory('baron')
    hasBaron = solver_opt.available()
except ApplicationError as err:
    print("Partial test completed. %s"%err)


if alamo_ran and hasBaron:
    model = pyo.ConcreteModel()
    opt = pyo.SolverFactory('baron')
    model.x1 = pyo.Var()
    model.x2 = pyo.Var()
    def pyomo_model(model):
        import z1
        return z1.f(model.x1,model.x2)
    model.obj = pyo.Objective(rule = pyomo_model)
    results = opt.solve(model)
    model.solutions.store_to(results)
    print(results)
------------------

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-1-b0dff88c0fa0> in <module>
     16         return z1.f(model.x1,model.x2)
     17     model.obj = pyo.Objective(rule = pyomo_model)
---> 18     results = opt.solve(model)
     19     model.solutions.store_to(results)
     20     print(results)

~/opt/conda/envs/examples-rel/lib/python3.7/site-packages/pyomo/opt/base/solvers.py in solve(self, *args, **kwds)
    601                 print("      %6.2f seconds required for solver" % (solve_completion_time - presolve_completion_time))
    602 
--> 603             result = self._postsolve()
    604             result._smap_id = self._smap_id
    605             result._smap = None

~/opt/conda/envs/examples-rel/lib/python3.7/site-packages/pyomo/opt/solver/shellcmd.py in _postsolve(self)
    267 
    268         if self._results_format is not None:
--> 269             results = self.process_output(self._rc)
    270             #
    271             # If keepfiles is true, then we pop the

~/opt/conda/envs/examples-rel/lib/python3.7/site-packages/pyomo/opt/solver/shellcmd.py in process_output(self, rc)
    329             print("      %6.2f seconds required to read logfile " % (log_file_completion_time - start_time))
    330         if self._results_reader is None:
--> 331             self.process_soln_file(results)
    332             soln_file_completion_time = time.time()
    333             if self._report_timing is True:

~/opt/conda/envs/examples-rel/lib/python3.7/site-packages/pyomo/solvers/plugins/solvers/BARON.py in process_soln_file(self, results)
    306         with open(self._tim_file, "r") as TimFile:
    307             with open(self._soln_file,"r") as INPUT:
--> 308                 self._process_soln_file(results, TimFile, INPUT)
    309 
    310     def _process_soln_file(self, results, TimFile, INPUT):

~/opt/conda/envs/examples-rel/lib/python3.7/site-packages/pyomo/solvers/plugins/solvers/BARON.py in _process_soln_file(self, results, TimFile, INPUT)
    350         results.problem.number_of_constraints = int(line[1])
    351         results.problem.number_of_variables = int(line[2])
--> 352         results.problem.lower_bound = float(line[5])
    353         results.problem.upper_bound = float(line[6])
    354         soln.gap = results.problem.upper_bound - results.problem.lower_bound

ValueError: could not convert string to float: '-.261415769428+256'
ValueError: could not convert string to float: '-.261415769428+256'

2021-01-13 17:17:30,754 ERROR - [Worker 6] Execution failed: generating partial output for '/home/lbianchi/idaes/examples-pse-rel/src/Examples/SurrMod/ALAMO/ALAMO_six_hump_camel.ipynb'

Add contact info and other boilerplate to Jupyter notebooks

Add contact information and copyright boilerplate to generated notebooks. This should also be used to insert the boilerplate into downloaded notebooks (idaes-pse command idaes get-examples), so a self-contained function that takes a notebook object and modifies it would be ideal.

Here is the text on the main documentation page:

General, background and overview information is available at the IDAES main website. 
Framework development happens at our GitHub repo where you can report issues/bugs or make contributions. 
For further enquiries, send an email to: <[email protected]>

Refactor "framework" for building docs to use standalone notebook metadata

example first cell in notebook:

# The Title of the Notebook

The description of the notebook. This can be multiple sentences or paragraphs, but the first sentence will be "special".
The description ends when the bulleted list starts.
- Authors: Wardell C., Klay T.
- Keywords: splash, brothers
- Type: Example

Build error with examples-pse 1.8.0 in file Tutorials/Advanced/ParamEst/DMF_flash_unit_Model_with_NRTL_solution.ipynb

2021-01-13 17:17:46,313 ERROR - [Worker 0] Notebook execution failed: execution error for '/tmp/tmpdz3kfiy4/DMF_flash_unit_Model_with_NRTL_solution.ipynb': An error occurred while executing the following cell:
------------------
from idaes.generic_models.unit_models import Flash
m.fs.flash = Flash(default={"property_package": m.fs.properties})
------------------

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-6a6bc63bd76a> in <module>
      1 from idaes.generic_models.unit_models import Flash
----> 2 m.fs.flash = Flash(default={"property_package": m.fs.properties})

~/opt/conda/envs/examples-rel/lib/python3.7/site-packages/pyomo/core/base/block.py in __getattr__(self, val)
    522         # throw the "normal" AttributeError
    523         raise AttributeError("'%s' object has no attribute '%s'"
--> 524                              % (self.__class__.__name__, val))
    525 
    526     def __setattr__(self, name, val):

AttributeError: '_ScalarFlowsheetBlock' object has no attribute 'properties'
AttributeError: '_ScalarFlowsheetBlock' object has no attribute 'properties'

2021-01-13 17:17:46,313 ERROR - [Worker 0] Execution failed: generating partial output for '/home/lbianchi/idaes/examples-pse-rel/src/Tutorials/Advanced/ParamEst/DMF_flash_unit_Model_with_NRTL_solution_testing.ipynb'

Build error with examples-pse 1.9.0rc0 in notebook Examples/Pecos/data_quality_control.ipynb

Content of the cell where the error occurs:

test_results_graphics = pecos.graphics.plot_test_results(data=pm.data, test_results=pm.test_results)

filename = pecos.io.write_monitoring_report(data=pm.data, test_results=pm.test_results, metrics=QCI.to_frame('QCI'), 
                                            test_results_graphics=test_results_graphics, encode=True,
                                            filename='simple_report.html')

Error traceback:

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-1-f5b7d540faf7> in <module>
      3 filename = pecos.io.write_monitoring_report(data=pm.data, test_results=pm.test_results, metrics=QCI.to_frame('QCI'), 
      4                                             test_results_graphics=test_results_graphics, encode=True,
----> 5                                             filename='simple_report.html')

~/anaconda3/envs/examples-rel/lib/python3.7/site-packages/pecos/io.py in write_monitoring_report(data, test_results, test_results_graphics, custom_graphics, metrics, title, config, logo, im_width_test_results, im_width_custom, im_width_logo, encode, file_format, filename)
    340 
    341         file_string = _html_template_monitoring_report(content, title, logo, 
--> 342                             im_width_test_results, im_width_custom, im_width_logo, encode)
    343     else:
    344         test_results_graphics = [g.replace('\\', '/') for g in test_results_graphics]

~/anaconda3/envs/examples-rel/lib/python3.7/site-packages/pecos/io.py in _html_template_monitoring_report(content, title, logo, im_width_test_results, im_width_custom, im_width_logo, encode)
    479             img_dic[im] = img_encode
    480         im = content['pecos_logo']
--> 481         img_encode = base64.b64encode(open(im, "rb").read()).decode("utf-8")
    482         img_dic[im] = img_encode
    483 

FileNotFoundError: [Errno 2] No such file or directory: '/home/ksb/anaconda3/envs/examples-rel/lib/python3.7/site-packages/pecos/../documentation/figures/logo.png'
FileNotFoundError: [Errno 2] No such file or directory: '/home/ksb/anaconda3/envs/examples-rel/lib/python3.7/site-packages/pecos/../documentation/figures/logo.png'

Solver error on CentOS 8 in Examples/Advanced/CustomProperties/air_separation_case_study.ipynb: ValueError: Cannot load a SolverResults object with bad status

2021-11-30 16:37:22,826 INFO - [Worker 0] Convert notebook name=/home/lbianchi/idaes/examples-pse/src/Examples/Advanced/CustomProperties/air_separation_case_study.ipynb: begin
2021-11-30 16:37:22,826 INFO - [Worker 0] Converting: air_separation_case_study.ipynb
2021-11-30 16:37:23,516 INFO - [Worker 0] Stripped tags from: air_separation_case_study.ipynb
2021-11-30 16:37:23,516 INFO - [Worker 0] Running notebook: air_separation_case_study.ipynb
2021-11-30 16:40:27,235 ERROR - [Worker 0] Notebook execution failed: execution error for '/tmp/tmpb256ax7o/air_separation_case_study.ipynb': An error occurred while executing the following cell:
------------------
m1.fs.F101.heat_duty[0].unfix()
m1.fs.F101.vap_outlet.temperature.fix(77.01)

m1.fs.M101.initialize(outlvl=idaeslog.INFO_LOW) 
propagate_state(m1.fs.s01)
m1.fs.F101.initialize(outlvl=idaeslog.INFO_LOW) 
------------------

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/tmp/ipykernel_116262/2523001707.py in <module>
      2 m1.fs.F101.vap_outlet.temperature.fix(77.01)
      3 
----> 4 m1.fs.M101.initialize(outlvl=idaeslog.INFO_LOW)
      5 propagate_state(m1.fs.s01)
      6 m1.fs.F101.initialize(outlvl=idaeslog.INFO_LOW)

~/opt/conda/envs/build-idaes-1.12.0rc0/lib/python3.8/site-packages/idaes/generic_models/unit_models/mixer.py in initialize(blk, outlvl, optarg, solver, hold_state)
    935             else:
    936                 with idaeslog.solver_log(solve_log, idaeslog.DEBUG) as slc:
--> 937                     res = opt.solve(blk, tee=slc.tee)
    938 
    939             init_log.info(

~/opt/conda/envs/build-idaes-1.12.0rc0/lib/python3.8/site-packages/pyomo/opt/base/solvers.py in solve(self, *args, **kwds)
    624                 else:
    625                     if self._load_solutions:
--> 626                         _model.solutions.load_from(
    627                             result,
    628                             select=self._select_index,

~/opt/conda/envs/build-idaes-1.12.0rc0/lib/python3.8/site-packages/pyomo/core/base/PyomoModel.py in load_from(self, results, allow_consistent_values_for_fixed_vars, comparison_tolerance_for_fixed_vars, ignore_invalid_labels, id, delete_symbol_map, clear, default_variable_value, select, ignore_fixed_vars)
    222                     "an 'aborted' status, but containing a solution")
    223             else:
--> 224                 raise ValueError("Cannot load a SolverResults object "
    225                                  "with bad status: %s"
    226                                  % str(results.solver.status))

ValueError: Cannot load a SolverResults object with bad status: error
ValueError: Cannot load a SolverResults object with bad status: error

2021-11-30 16:40:27,235 ERROR - [Worker 0] Execution failed: generating partial output for '/home/lbianchi/idaes/examples-pse/src/Examples/Advanced/CustomProperties/air_separation_case_study.ipynb'
2021-11-30 16:40:27,235 INFO - [Worker 0] Convert notebook name=/home/lbianchi/idaes/examples-pse/src/Examples/Advanced/CustomProperties/air_separation_case_study.ipynb: end, ok=False duration=184.4s

Rework examples/src structure

Propose changing existing src structure for the following reasons:

  • @dangunter and I have been a bit confused with the current set up of the src folder especially when working on IDAES/examples-dev#108 as to what constitutes as "workshop" and what constitutes as "tutorial".
  • It is difficult for a new user to identify where to start: Tutorials or workshops.
  • What is the recommended progression for a new user when looking at the examples?

Proposed new structure:

src
  tutorials
     basics
         Intro to Python and Pyomo
     unit_models
          Flash Unit Model
          Other unit models
     Flowsheets
          HDA Flowsheet
          Allows adding power plant and other flowsheets in future
     Advanced
          Property packages
          Custom model development
          Parameter estimation
              parameter estimation using NRTL 
              data_recon_and_parameter_estimation
     dmf
          dmf related notebooks
     matopt 
     surrogate

For clarity, the current structure is as follows:

src
  matopt
  surrogate
  tutorials
     unit_models
     advanced
        custom model development
        data_recon_and_parameter_estimation
     property packages
     tools
  workshops
       Intro to Pyomo
       Flash Unit Model
       HDA Flowsheet
       Parameter Estimation

Currently, the major distinction between workshop and tutorial notebooks is the existence of "exercise cells". With the new structure, we will end up with notebooks in a folder that will have an exercise version and a tutorial version. Might be confusing to the user (maybe) as to why some notebooks are like exercises and some are not.

Thoughts?

Broken link in README

In the readme:

https://github.com/IDAES/examples-pse/blob/main/README.md?plain=1

The following section contains a broken link:

## Install

First, you need to download and install the examples locally, on your own computer.
Instructions for doing this are in the
[install instructions](https://idaes-pse.readthedocs.io/en/stable/install/index.html)
in the main IDAES-PSE toolkit documentation -- under the "Generic install"
section. That page also contains a link to more detailed help on the
options for choosing a custom installation directory.

The link is:

https://idaes-pse.readthedocs.io/en/stable/install/index.html

Check json initial points for unitialized variables

The idea originates in the #81 discussion.

When the underlying IDAES model changes, the initial points saved as part of the examples become stale. This can cause unexpected long solve times which are challenging to track down the root cause.

Problems with MatOpt examples

There are problems with the generated notebook examples for MatOpt in the 1.5.0 release on RTD: https://examples-pse.readthedocs.io/en/1.5.0

  • "Monometallic Nanocluster Design", "Surface Design" and "Bifunctional Catalyst Design" solutions all show:

    CPLEX> CPLEX Error  1217: No solution exists.
    No file written.
    CPLEX> ERROR: evaluating object as numeric value: obj
            (object: <class 'pyomo.core.base.objective.SimpleObjective'>)
        No value for uninitialized NumericValue object obj
    MaOpt can not find usable solver (CPLEX or NEOS-CPLEX)
    
  • Both "Bimetallic Nanocluster Design" and "Metal Oxide Bulk Design" have:

    from matopt import *
    ---------------------------------------------------------------------------
    ModuleNotFoundError                       Traceback (most recent call last)
    <ipython-input-2-be5adc2fb850> in <module>
    ----> 1 from matopt import *
    ModuleNotFoundError: No module named 'matopt'
    

Errors when building notebooks for 1.7.0 (seems fixed on second build, could not reproduce)

While building the examples for the 1.7.0 release yesterday with @ksbeattie, the python build.py -cdr step resulted in the errors reported below from notebook-errors.txt. When I tried to run the build a second time with the exact same version of the code, the build completed without errors, and we haven't been able to reproduce the errors.

Even though the issue seems to have been resolved by itself this time, it would be good to see if we can understand why these errors occurred, and if there are ways to avoid this happening in the future to try and keep our builds as deterministic as possible.

I've added some info about the environment used for the build, but let me know if there are other checks to make (e.g. concerning specific solvers).

Error # 1

====> File: /home/ksb/Projects/IDAES/github/IDAES/examples-pse-rel/src/workshops/Parameter_Estimation/Parameter_estimation_NRTL_using_unit_model_solution_testing.ipynb
execution error for '/tmp/tmpg76u6w_1/Parameter_estimation_NRTL_using_unit_model_solution.ipynb': An error occurred while executing the following cell:
------------------
# Run parameter estimation using bootstrap resample of the data (10 samples),
# plot results along with confidence regions
bootstrap_theta = pest.theta_est_bootstrap(10)
------------------

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-1-69aa634c261e> in <module>
      1 # Run parameter estimation using bootstrap resample of the data (10 samples),
      2 # plot results along with confidence regions
----> 3 bootstrap_theta = pest.theta_est_bootstrap(10)

~/anaconda3/envs/examples-rel/lib/python3.7/site-packages/pyomo/contrib/parmest/parmest.py in theta_est_bootstrap(self, bootstrap_samples, samplesize, replacement, seed, return_samples)
    848         bootstrap_theta = list()
    849         for idx, sample in local_list:
--> 850             objval, thetavals = self.theta_est(bootlist=list(sample))
    851             thetavals['samples'] = sample
    852             bootstrap_theta.append(thetavals)

~/anaconda3/envs/examples-rel/lib/python3.7/site-packages/pyomo/contrib/parmest/parmest.py in theta_est(self, solver, return_values, bootlist, calc_cov)
    797 
    798         return self._Q_opt(solver=solver, return_values=return_values,
--> 799                            bootlist=bootlist, calc_cov=calc_cov)
    800 
    801 

~/anaconda3/envs/examples-rel/lib/python3.7/site-packages/pyomo/contrib/parmest/parmest.py in _Q_opt(self, ThetaVals, solver, return_values, bootlist, calc_cov)
    493                     self.ef_instance.solutions.load_from(solve_result)
    494                 else:
--> 495                     solve_result = solver.solve(self.ef_instance, tee = self.tee)
    496 
    497             elif not asl_available:

~/anaconda3/envs/examples-rel/lib/python3.7/site-packages/pyomo/opt/base/solvers.py in solve(self, *args, **kwds)
    631                             result,
    632                             select=self._select_index,
--> 633                             default_variable_value=self._default_variable_value)
    634                         result._smap_id = None
    635                         result.solution.clear()

~/anaconda3/envs/examples-rel/lib/python3.7/site-packages/pyomo/core/base/PyomoModel.py in load_from(self, results, allow_consistent_values_for_fixed_vars, comparison_tolerance_for_fixed_vars, ignore_invalid_labels, id, delete_symbol_map, clear, default_variable_value, select, ignore_fixed_vars)
    240                 raise ValueError("Cannot load a SolverResults object "
    241                                  "with bad status: %s"
--> 242                                  % str(results.solver.status))
    243         if clear:
    244             #

ValueError: Cannot load a SolverResults object with bad status: error
ValueError: Cannot load a SolverResults object with bad status: error

Error # 2

====> File: /home/ksb/Projects/IDAES/github/IDAES/examples-pse-rel/src/surrogate/alamo_python/Six_Hump_Camel.ipynb
execution error for '/tmp/tmp_oi6fwj9/Six_Hump_Camel.ipynb': An error occurred while executing the following cell:
------------------
hasBaron = False
try:
    solver_opt = pyo.SolverFactory('baron')
    hasBaron = solver_opt.available()
except ApplicationError as err:
    print("Partial test completed. %s"%err)


if alamo_ran and hasBaron:
    model = pyo.ConcreteModel()
    opt = pyo.SolverFactory('baron')
    model.x1 = pyo.Var()
    model.x2 = pyo.Var()
    def pyomo_model(model):
        import z1
        return z1.f(model.x1,model.x2)
    model.obj = pyo.Objective(rule = pyomo_model)
    results = opt.solve(model)
    model.solutions.store_to(results)
    print(results)
------------------

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-1-b0dff88c0fa0> in <module>
     16         return z1.f(model.x1,model.x2)
     17     model.obj = pyo.Objective(rule = pyomo_model)
---> 18     results = opt.solve(model)
     19     model.solutions.store_to(results)
     20     print(results)

~/anaconda3/envs/examples-rel/lib/python3.7/site-packages/pyomo/opt/base/solvers.py in solve(self, *args, **kwds)
    603                 print("      %6.2f seconds required for solver" % (solve_completion_time - presolve_completion_time))
    604 
--> 605             result = self._postsolve()
    606             result._smap_id = self._smap_id
    607             result._smap = None

~/anaconda3/envs/examples-rel/lib/python3.7/site-packages/pyomo/opt/solver/shellcmd.py in _postsolve(self)
    268 
    269         if self._results_format is not None:
--> 270             results = self.process_output(self._rc)
    271             #
    272             # If keepfiles is true, then we pop the

~/anaconda3/envs/examples-rel/lib/python3.7/site-packages/pyomo/opt/solver/shellcmd.py in process_output(self, rc)
    330             print("      %6.2f seconds required to read logfile " % (log_file_completion_time - start_time))
    331         if self._results_reader is None:
--> 332             self.process_soln_file(results)
    333             soln_file_completion_time = time.time()
    334             if self._report_timing is True:

~/anaconda3/envs/examples-rel/lib/python3.7/site-packages/pyomo/solvers/plugins/solvers/BARON.py in process_soln_file(self, results)
    311         with open(self._tim_file, "r") as TimFile:
    312             with open(self._soln_file,"r") as INPUT:
--> 313                 self._process_soln_file(results, TimFile, INPUT)
    314 
    315     def _process_soln_file(self, results, TimFile, INPUT):

~/anaconda3/envs/examples-rel/lib/python3.7/site-packages/pyomo/solvers/plugins/solvers/BARON.py in _process_soln_file(self, results, TimFile, INPUT)
    355         results.problem.number_of_constraints = int(line[1])
    356         results.problem.number_of_variables = int(line[2])
--> 357         results.problem.lower_bound = float(line[5])
    358         results.problem.upper_bound = float(line[6])
    359         soln.gap = results.problem.upper_bound - results.problem.lower_bound

ValueError: could not convert string to float: '-.906976270652+240'
ValueError: could not convert string to float: '-.906976270652+240'

Info about build environment

Output of `conda list`
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
alabaster                 0.7.12                   pypi_0    pypi
argon2-cffi               20.1.0                   pypi_0    pypi
async-generator           1.10                     pypi_0    pypi
attrs                     20.2.0                   pypi_0    pypi
babel                     2.8.0                    pypi_0    pypi
backcall                  0.2.0                    pypi_0    pypi
backports-shutil-get-terminal-size 1.0.0                    pypi_0    pypi
bleach                    3.2.1                    pypi_0    pypi
bunch                     1.0.1                    pypi_0    pypi
ca-certificates           2020.7.22                     0  
certifi                   2020.6.20                py37_0  
cffi                      1.14.3                   pypi_0    pypi
chardet                   3.0.4                    pypi_0    pypi
click                     7.1.2                    pypi_0    pypi
colorama                  0.4.3                    pypi_0    pypi
cycler                    0.10.0                   pypi_0    pypi
decorator                 4.4.2                    pypi_0    pypi
defusedxml                0.6.0                    pypi_0    pypi
docutils                  0.16                     pypi_0    pypi
entrypoints               0.3                      pypi_0    pypi
flask                     1.1.2                    pypi_0    pypi
flask-cors                3.0.9                    pypi_0    pypi
idaes-pse                 1.7.0                    pypi_0    pypi
idna                      2.10                     pypi_0    pypi
imagesize                 1.2.0                    pypi_0    pypi
importlib-metadata        2.0.0                    pypi_0    pypi
iniconfig                 1.0.1                    pypi_0    pypi
ipykernel                 5.3.4                    pypi_0    pypi
ipython                   7.18.1                   pypi_0    pypi
ipython-genutils          0.2.0                    pypi_0    pypi
ipywidgets                7.5.1                    pypi_0    pypi
itsdangerous              1.1.0                    pypi_0    pypi
jedi                      0.17.2                   pypi_0    pypi
jinja2                    2.11.2                   pypi_0    pypi
jsonschema                3.2.0                    pypi_0    pypi
jupyter                   1.0.0                    pypi_0    pypi
jupyter-client            6.1.7                    pypi_0    pypi
jupyter-console           6.2.0                    pypi_0    pypi
jupyter-core              4.6.3                    pypi_0    pypi
jupyterlab-pygments       0.1.2                    pypi_0    pypi
kiwisolver                1.2.0                    pypi_0    pypi
ld_impl_linux-64          2.33.1               h53a641e_7  
libedit                   3.1.20191231         h14c3975_1  
libffi                    3.3                  he6710b0_2  
libgcc-ng                 9.1.0                hdf63c60_0  
libstdcxx-ng              9.1.0                hdf63c60_0  
lxml                      4.5.2                    pypi_0    pypi
markupsafe                1.1.1                    pypi_0    pypi
matplotlib                3.3.2                    pypi_0    pypi
mistune                   0.8.4                    pypi_0    pypi
mock                      4.0.2                    pypi_0    pypi
mpmath                    1.1.0                    pypi_0    pypi
nbclient                  0.5.0                    pypi_0    pypi
nbconvert                 6.0.7                    pypi_0    pypi
nbformat                  5.0.7                    pypi_0    pypi
ncurses                   6.2                  he6710b0_1  
nest-asyncio              1.4.1                    pypi_0    pypi
networkx                  2.5                      pypi_0    pypi
nose                      1.3.7                    pypi_0    pypi
notebook                  6.1.4                    pypi_0    pypi
numpy                     1.19.2                   pypi_0    pypi
openssl                   1.1.1h               h7b6447c_0  
packaging                 20.4                     pypi_0    pypi
pandas                    1.1.3                    pypi_0    pypi
pandocfilters             1.4.2                    pypi_0    pypi
parso                     0.7.1                    pypi_0    pypi
pexpect                   4.8.0                    pypi_0    pypi
pickleshare               0.7.5                    pypi_0    pypi
pillow                    7.2.0                    pypi_0    pypi
pint                      0.16.1                   pypi_0    pypi
pip                       20.2.3                   py37_0  
pluggy                    0.13.1                   pypi_0    pypi
ply                       3.11                     pypi_0    pypi
prometheus-client         0.8.0                    pypi_0    pypi
prompt-toolkit            3.0.7                    pypi_0    pypi
psutil                    5.7.2                    pypi_0    pypi
ptyprocess                0.6.0                    pypi_0    pypi
py                        1.9.0                    pypi_0    pypi
pycparser                 2.20                     pypi_0    pypi
pygments                  2.7.1                    pypi_0    pypi
pyomo                     5.7.1                    pypi_0    pypi
pyparsing                 2.4.7                    pypi_0    pypi
pyrsistent                0.17.3                   pypi_0    pypi
pytest                    6.1.1                    pypi_0    pypi
python                    3.7.9                h7579374_0  
python-dateutil           2.8.1                    pypi_0    pypi
python-slugify            4.0.1                    pypi_0    pypi
pytz                      2020.1                   pypi_0    pypi
pyutilib                  6.0.0                    pypi_0    pypi
pyyaml                    5.3.1                    pypi_0    pypi
pyzmq                     19.0.2                   pypi_0    pypi
qtconsole                 4.7.7                    pypi_0    pypi
qtpy                      1.9.0                    pypi_0    pypi
rbfopt                    4.2.1                    pypi_0    pypi
readline                  8.0                  h7b6447c_0  
requests                  2.24.0                   pypi_0    pypi
scipy                     1.5.2                    pypi_0    pypi
send2trash                1.5.0                    pypi_0    pypi
setuptools                50.3.0           py37hb0f4dca_1  
six                       1.15.0                   pypi_0    pypi
snowballstemmer           2.0.0                    pypi_0    pypi
sphinx                    3.2.1                    pypi_0    pypi
sphinx-rtd-theme          0.5.0                    pypi_0    pypi
sphinxcontrib-applehelp   1.0.2                    pypi_0    pypi
sphinxcontrib-devhelp     1.0.2                    pypi_0    pypi
sphinxcontrib-htmlhelp    1.0.3                    pypi_0    pypi
sphinxcontrib-jsmath      1.0.1                    pypi_0    pypi
sphinxcontrib-qthelp      1.0.3                    pypi_0    pypi
sphinxcontrib-serializinghtml 1.1.4                    pypi_0    pypi
sqlite                    3.33.0               h62c20be_0  
sympy                     1.6.2                    pypi_0    pypi
terminado                 0.9.1                    pypi_0    pypi
testpath                  0.4.4                    pypi_0    pypi
text-unidecode            1.3                      pypi_0    pypi
tinydb                    4.2.0                    pypi_0    pypi
tk                        8.6.10               hbc83047_0  
toml                      0.10.1                   pypi_0    pypi
tornado                   6.0.4                    pypi_0    pypi
traitlets                 5.0.4                    pypi_0    pypi
urllib3                   1.25.10                  pypi_0    pypi
wcwidth                   0.2.5                    pypi_0    pypi
webencodings              0.5.1                    pypi_0    pypi
werkzeug                  1.0.1                    pypi_0    pypi
wheel                     0.35.1                     py_0  
widgetsnbextension        3.5.1                    pypi_0    pypi
xz                        5.2.5                h7b6447c_0  
zipp                      3.3.0                    pypi_0    pypi
zlib                      1.2.11               h7b6447c_3  

Several examples tests failing

There are some examples test failing. I'm having a hard time sorting out what's failing and how, but I suspect it may have something to do with the doc reorg or updating the Pyomo version. Not sure who to assign this too, so we can try to update that later.

From doc build:

docs_test/Examples/Tools/degeneracy_hunter.rst:234: ERROR: Undefined substitution referenced: "residual".
docs_test/Examples/Tools/degeneracy_hunter.rst:234: ERROR: Undefined substitution referenced: "residual".
docs_test/Examples/Tools/degeneracy_hunter.rst:409: ERROR: Undefined substitution referenced: "residual".
docs_test/Examples/Tools/degeneracy_hunter.rst:409: ERROR: Undefined substitution referenced: "residual".
docs_test/Examples/Tools/degeneracy_hunter.rst:409: ERROR: Undefined substitution referenced: "residual".
docs_test/Examples/Tools/degeneracy_hunter.rst:712: ERROR: Undefined substitution referenced: "residual".
docs_test/Examples/Tools/degeneracy_hunter.rst:712: ERROR: Undefined substitution referenced: "residual".
docs_test/Examples/Tools/data_management_framework.rst:514: ERROR: Unknown target name: "id".
docs_test/Examples/Tools/data_management_framework.rst:576: ERROR: Unknown target name: "id".
docs_test/Examples/SurrMod/PySMO/PySMO_basics.rst:378: ERROR: Unknown target name: "x".
docs_test/Examples/SurrMod/PySMO/PySMO_basics.rst:378: ERROR: Unknown target name: "x".
docs_test/Examples/SurrMod/PySMO/PySMO_basics.rst:378: ERROR: Unknown target name: "x".
docs_test/Examples/SurrMod/PySMO/PySMO_basics.rst:378: ERROR: Unknown target name: "x".
docs_test/Examples/SurrMod/PySMO/PySMO_basics.rst:378: ERROR: Unknown target name: "x".
docs_test/Examples/SurrMod/PySMO/PySMO_basics.rst:378: ERROR: Unknown target name: "x".
docs_test/Examples/SurrMod/PySMO/PySMO_basics.rst:378: ERROR: Unknown target name: "x".
TypeError: object NoneType can't be used in 'await' expression
2022-02-14 17:52:01,553 ERROR - [Worker 0] Notebook execution failed: execution error for '/tmp/tmpfbxogeg6/air_separation_case_study.ipynb': An error occurred while executing the following cell:
------------------
m.fs.M101.initialize(outlvl=idaeslog.INFO_LOW) 
propagate_state(m.fs.s01)
m.fs.F101.initialize(outlvl=idaeslog.INFO_LOW)
------------------

---------------------------------------------------------------------------
InitializationError                       Traceback (most recent call last)
/tmp/ipykernel_3865/2171148868.py in <module>
      1 m.fs.M101.initialize(outlvl=idaeslog.INFO_LOW)
      2 propagate_state(m.fs.s01)
----> 3 m.fs.F101.initialize(outlvl=idaeslog.INFO_LOW)

/usr/share/miniconda/envs/examples-pse-dev/lib/python3.8/site-packages/idaes/core/unit_model.py in initialize(blk, state_args, outlvl, solver, optarg)
    659 
    660         if not check_optimal_termination(results):
--> 661             raise InitializationError(
    662                 f"{blk.name} failed to initialize successfully. Please check "
    663                 f"the output logs for more information.")
 2022-02-14 18:25:50,515 DEBUG - Waiting for 1 processes to finish
2022-02-14 18:26:51,519 DEBUG - Waiting for 1 processes to finish
2022-02-14 18:27:22,356 ERROR - [Worker 0] Failed to convert D:\a\examples-pse\examples-pse\src\Examples\Advanced\CustomProperties\Hydrocarbon_Processing_example.ipynb: timeout for 'C:\Users\RUNNER~1\AppData\Local\Temp\tmprw3iry3j\Hydrocarbon_Processing_example.ipynb': 1280.1595520973206s > 600s

Timeout errors for Examples/Advanced/CustomProperties/Hydrocarbon_Processing_example.ipynb

The maximum runtime allowed for a single notebook is limited to the value of the timeout parameter in build.yml, which is currently set to 600 s for our CI builds. If a notebook takes longer than that to run, it results in an error.

 2021-12-20 05:55:53,309 ERROR - [Worker 0] Failed to convert /home/runner/work/examples-pse/examples-pse/src/Examples/Advanced/CustomProperties/Hydrocarbon_Processing_example.ipynb: timeout for '/tmp/tmpcmwownao/Hydrocarbon_Processing_example.ipynb': 644.0461659431458s > 600s

Lately, this seems to be happening often for the Examples/Advanced/CustomProperties/Hydrocarbon_Processing_example.ipynb notebook, resulting in failing CI runs in both our nightly builds and unrelated PRs such as #80.

We should look into why the notebook is taking longer than it used to (since, until lately, the runtime was below the 600 s timeout), and, more in general, see if there could be ways to modify the notebook so that it runs as quickly as possible.

Better logging of issues when building example notebooks

It would be helpful for debugging purposes if we could collect the traceback when a notebook fails during the build process and present it to the developer/reviewers in a convenient form. At the moment, the actual error traceback is buried in with the debugging output from the build process. It is not immediately obvious where to look for it, and it can take a lot of scrolling to find the actual output.

If we could either collect this information in a separate report file, or suppress a lot of the extraneous debugging output, it would help with the debugging process.

Improving Power Plant Examples For CI Runs

  • The example notebook src/Examples/Flowsheets/power_generation/ngcc/ngcc_soec.ipynb exhibits stable solver behavior due to recent improvements. However, the runtime hovers around 600 seconds resulting in intermittent timeout failures on some CI runs. This issue is resolved in #157 (replaced by #158).

  • Similarly, the example notebook src/Examples/Flowsheets/power_generation/rsofc/rsofc_soec_example.ipynb encountered intermittent solver issues on some CI runs. This issue was resolved internally, and should not occur once #154 is merged.

Rework examples/src structure

Originally created by @jghouse88 9/21/2020


Propose changing existing src structure for the following reasons:

  • @dangunter and I have been a bit confused with the current set up of the src folder especially when working on #108 as to what constitutes as "workshop" and what constitutes as "tutorial".
  • It is difficult for a new user to identify where to start: Tutorials or workshops.
  • What is the recommended progression for a new user when looking at the examples?

Proposed new structure:

src
  tutorials
     basics
         Intro to Python and Pyomo
     unit_models
          Flash Unit Model
          Other unit models
     Flowsheets
          HDA Flowsheet
          Allows adding power plant and other flowsheets in future
     Advanced
          Property packages
          Custom model development
          Parameter estimation
              parameter estimation using NRTL 
              data_recon_and_parameter_estimation
     dmf
          dmf related notebooks
     matopt 
     surrogate

For clarity, the current structure is as follows:

src
  matopt
  surrogate
  tutorials
     unit_models
     advanced
        custom model development
        data_recon_and_parameter_estimation
     property packages
     tools
  workshops
       Intro to Pyomo
       Flash Unit Model
       HDA Flowsheet
       Parameter Estimation

Currently, the major distinction between workshop and tutorial notebooks is the existence of "exercise cells". With the new structure, we will end up with notebooks in a folder that will have an exercise version and a tutorial version. Might be confusing to the user (maybe) as to why some notebooks are like exercises and some are not.

  • Thoughts?

Comment by @andrewlee94 9/22/20

First, I think this is long overdue and we do need to have a structure that helps users through the progression (plus a landing page which explains it in more detail). Notably, what we currently call workshops are really tutorials and what we call tutorials are more like examples.

Regarding the proposed structure, I would be inclined to keep the current "workshops" (0, 1 & 2 at least) in the basics section - I see these as the basic instruction on how to get started after which you can branch out. I also note there is a big difference in style and content between Module 1 and the unit model examples. To the point, Module 1 is clearly a teaching module, whist the others are simpler examples of a unit in use (and we don't have the resources to expand them).

So, my suggestion would be to clearly identify teaching units (workshops or actual tutorials) from simpler examples. They can possibly be grouped in to categories as @jghouse88 suggested, but I think we need to make the content clearer so people can easily find the tutorials before diving into examples. I.e. each set of examples should have a related tutorial which provides the necessary introduction (which could simply be the same content with deeper explanation).


Comment by @TimBartholomew 9/22/20

I think the proposed structure is significantly better than what we have. There really was no distinction between tutorials and workshops, so combing that to tutorials makes a lot of sense.

I agree with @andrewlee94 about making a distinction between tutorials and examples. It's also what I envisioned when I did the reorg on idaes-pse readthedocs, where the link to the examples site is under "Tutorials and Examples".

I think the best way to make this distinction is just at the top level. Like the following:

src
  tutorials
    ...
  examples
    ...

I'd also probably squash the previous workshops in basic tutorials because creating a flowsheet and doing some simulation and optimization is the minimum of what a user would do in IDAES. Something like this possibly:

src
  tutorials
    basics
       intro to python and pyomo
       simulation - flash unit
       optimization - HDA flowsheet
    advanced
       custom property packages
          simple, detailed, ...
       custom unit models
          simple, detailed, 1D, ...
       parameter estimation
       dmf
         (dmf notebooks, if they are tutorials)
       modeling extensions
         (matopt, surrogate, if they are tutorials)
  examples
    unit models
      ...
    flowsheets
      ...
    dmf
      (dmf notebooks, if they are examples)
    modeling extensions
       (matopt, surrogate, if they are examples)

Comment by @jghouse88 9/22

@andrewlee94 and @TimBartholomew I like the examples/tutorials distinction. I also thought of including the current modules 0, 1, and 2 under basics but then thought they are better grouped under unit models/flowsheets. However, I am fine with having it under basics.

Bottom line:

tutorials are learning notebooks with or without exercises with detailed explanation
examples are just simple notebooks without exercises with less detailed explanation

I am fine with this distinction. If all agree we can do the reorg once the Sept release has been cut.


Comment by @andrewlee94 9/22

So, an alternative would be to do as @jghouse88 suggested, but clearly indicate tutorial versus example. A crude way would be to preface tutorials with "Txx" and examples with "Xxx" - that way the tutorials will appear at the top of the directory tree for each section.


Comment by @dangunter 9/24
Keep in mind that the installation of the examples with idaes get-examples already splits notebooks with 'exercise' cells into 2 notebooks, one with and without those cells. So tutorials and non-tutorials can be the same notebook.

I'm in favor of a flat structure, and we can guide users through it with the landing page. This gives us more flexibility without more reorgs in the future. I would suggest we drop not only the tutorials/examples structure, but also basic/advanced.

src
     Intro to Python and Pyomo
     unit_models
          Flash Unit Model
          Other unit models
     Flowsheets
          HDA Flowsheet
          Allows adding power plant and other flowsheets in future
      Property packages
      Custom model development
      Parameter estimation
              parameter estimation using NRTL 
              data_recon_and_parameter_estimation
     dmf
        ...
     matopt 
        ...
     surrogate
           ...

Comment by @andrewlee94 9/24

@dangunter To give an example of the tutorial and non-tutorial thing, we have Workshop Module 1 which is a detailed tutorial of a Flash unit model, but we also have the far simpler examples that Anuja and @jghouse88 have done for other unit models in the library. So, it is not that they are the same basic notebook with different cells, but different levels of detail when developing the notebook.

So far the unit model example, a user should really go to the Flash unit tutorial first as it has a lot more detail and instruction, and can then go look at the simpler examples for units they might be interested it. These could quite easily live in the same folder with each other (they all relate to unit models), but there needs to be some indication that you should start with the more detailed tutorial first.

Build script exits with 0 code despite notebook errors in certain cases

Description

image

  • This was observed in IDAES/idaes-pse#853, where the Run examples check seemed to fail on Linux runners and pass on Windows runners
  • This was unexpected for that particular PR, since the errors were ModuleNotFoundError that should occur regardless of the platform
  • In reality, the same errors are present on either platform, and the jobs passed on Windows only because the examples build script "fails to fail" for some reason

Next steps

  • AFAIK this issue has been occurring sporadically for quite some time, and therefore I don't think it's tied to any particular change that might have happened recently
  • Paraphrasing @andrewlee94 on the matter, tests that don't fail when they should are worse than tests that fail when they shouldn't, so we should try to get to the bottom of this

Examples/SurrMod/FlowsheetOptimization/ALAMO_flowsheet_optimization.ipynb fails with FileNotFoundError

examples-pse-2.0.0b2 | 2022-12-07 19:11:59,108 INFO - [Worker 0] Convert notebook name=/home/runner/examples-pse/src/Examples/SurrMod/FlowsheetOptimization/ALAMO_flowsheet_optimization.ipynb: begin
examples-pse-2.0.0b2 | 2022-12-07 19:11:59,108 INFO - [Worker 0] Converting: ALAMO_flowsheet_optimization.ipynb
examples-pse-2.0.0b2 | 2022-12-07 19:11:59,118 INFO - [Worker 0] Running notebook: ALAMO_flowsheet_optimization.ipynb
examples-pse-2.0.0b2 | 2022-12-07 19:12:02,647 ERROR - [Worker 0] Notebook execution failed: execution error for '/tmp/tmp918j3uts/ALAMO_flowsheet_optimization.ipynb': An error occurred while executing the following cell:
examples-pse-2.0.0b2 | ------------------
examples-pse-2.0.0b2 | # capture long output (not required to use surrogate API)
examples-pse-2.0.0b2 | from io import StringIO
examples-pse-2.0.0b2 | import sys
examples-pse-2.0.0b2 | stream = StringIO()
examples-pse-2.0.0b2 | oldstdout = sys.stdout
examples-pse-2.0.0b2 | sys.stdout = stream
examples-pse-2.0.0b2 | 
examples-pse-2.0.0b2 | # Create ALAMO trainer object
examples-pse-2.0.0b2 | trainer = AlamoTrainer(input_labels=input_labels,
examples-pse-2.0.0b2 |                        output_labels=output_labels,
examples-pse-2.0.0b2 |                        training_dataframe=data_training)
examples-pse-2.0.0b2 | 
examples-pse-2.0.0b2 | # Set ALAMO options
examples-pse-2.0.0b2 | trainer.config.constant = True
examples-pse-2.0.0b2 | trainer.config.linfcns = True
examples-pse-2.0.0b2 | trainer.config.multi2power = [1, 2]
examples-pse-2.0.0b2 | trainer.config.monomialpower = [2, 3]
examples-pse-2.0.0b2 | trainer.config.ratiopower = [1, 2]
examples-pse-2.0.0b2 | trainer.config.maxterms = [10] * len(output_labels)  # max for each surrogate
examples-pse-2.0.0b2 | trainer.config.filename = os.path.join(os.getcwd(), 'alamo_run.alm')
examples-pse-2.0.0b2 | trainer.config.overwrite_files = True
examples-pse-2.0.0b2 | 
examples-pse-2.0.0b2 | # Train surrogate (calls ALAMO through IDAES ALAMOPy wrapper)
examples-pse-2.0.0b2 | success, alm_surr, msg = trainer.train_surrogate()
examples-pse-2.0.0b2 | 
examples-pse-2.0.0b2 | # save model to JSON
examples-pse-2.0.0b2 | model = alm_surr.save_to_file('alamo_surrogate.json', overwrite=True)
examples-pse-2.0.0b2 | 
examples-pse-2.0.0b2 | # create callable surrogate object
examples-pse-2.0.0b2 | 
examples-pse-2.0.0b2 | surrogate_expressions = trainer._results['Model']
examples-pse-2.0.0b2 | input_labels = trainer._input_labels
examples-pse-2.0.0b2 | output_labels = trainer._output_labels
examples-pse-2.0.0b2 | xmin, xmax = [0.1, 0.8], [0.8, 1.2]
examples-pse-2.0.0b2 | input_bounds = {input_labels[i]: (xmin[i], xmax[i])
examples-pse-2.0.0b2 |                 for i in range(len(input_labels))}
examples-pse-2.0.0b2 | 
examples-pse-2.0.0b2 | alm_surr = AlamoSurrogate(surrogate_expressions,
examples-pse-2.0.0b2 |                           input_labels,
examples-pse-2.0.0b2 |                           output_labels,
examples-pse-2.0.0b2 |                           input_bounds)
examples-pse-2.0.0b2 | 
examples-pse-2.0.0b2 | # revert back to normal output capture
examples-pse-2.0.0b2 | sys.stdout = oldstdout
examples-pse-2.0.0b2 | 
examples-pse-2.0.0b2 | # display first 50 lines and last 50 lines of output
examples-pse-2.0.0b2 | celloutput = stream.getvalue().split('\n')
examples-pse-2.0.0b2 | for line in celloutput[:50]:
examples-pse-2.0.0b2 |     print(line)
examples-pse-2.0.0b2 | print('.')
examples-pse-2.0.0b2 | print('.')
examples-pse-2.0.0b2 | print('.')
examples-pse-2.0.0b2 | for line in celloutput[-50:]:
examples-pse-2.0.0b2 |     print(line)
examples-pse-2.0.0b2 | ------------------
examples-pse-2.0.0b2 | 
examples-pse-2.0.0b2 | ---------------------------------------------------------------------------
examples-pse-2.0.0b2 | FileNotFoundError                         Traceback (most recent call last)
examples-pse-2.0.0b2 | ~/.conda/envs/idaes-env/lib/python3.8/site-packages/idaes/core/surrogate/alamopy.py in _read_trace_file(self, trcfile, has_validation_data)
examples-pse-2.0.0b2 |    1027         try:
examples-pse-2.0.0b2 | -> 1028             with open(trcfile, "r") as f:
examples-pse-2.0.0b2 |    1029                 lines = f.readlines()
examples-pse-2.0.0b2 | 
examples-pse-2.0.0b2 | FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp918j3uts/alamo_run.trc'
examples-pse-2.0.0b2 | 
examples-pse-2.0.0b2 | During handling of the above exception, another exception occurred:
examples-pse-2.0.0b2 | 
examples-pse-2.0.0b2 | FileNotFoundError                         Traceback (most recent call last)
examples-pse-2.0.0b2 | /tmp/ipykernel_11348/2642844276.py in <cell line: 24>()
examples-pse-2.0.0b2 |      22 
examples-pse-2.0.0b2 |      23 # Train surrogate (calls ALAMO through IDAES ALAMOPy wrapper)
examples-pse-2.0.0b2 | ---> 24 success, alm_surr, msg = trainer.train_surrogate()
examples-pse-2.0.0b2 |      25 
examples-pse-2.0.0b2 |      26 # save model to JSON
examples-pse-2.0.0b2 | 
examples-pse-2.0.0b2 | ~/.conda/envs/idaes-env/lib/python3.8/site-packages/idaes/core/surrogate/alamopy.py in train_surrogate(self)
examples-pse-2.0.0b2 |     700 
examples-pse-2.0.0b2 |     701             # Read back results
examples-pse-2.0.0b2 | --> 702             trace_dict = self._read_trace_file(self._trcfile)
examples-pse-2.0.0b2 |     703 
examples-pse-2.0.0b2 |     704             # Populate results and SurrogateModel object
examples-pse-2.0.0b2 | 
examples-pse-2.0.0b2 | ~/.conda/envs/idaes-env/lib/python3.8/site-packages/idaes/core/surrogate/alamopy.py in _read_trace_file(self, trcfile, has_validation_data)
examples-pse-2.0.0b2 |    1031         except FileNotFoundError:
examples-pse-2.0.0b2 |    1032             # Trace file does not exist
examples-pse-2.0.0b2 | -> 1033             raise FileNotFoundError(
examples-pse-2.0.0b2 |    1034                 "Error occured when trying to read the ALAMO trace file - this probably "
examples-pse-2.0.0b2 |    1035                 "indicates that a trace file was not created by the ALAMO executable. "
examples-pse-2.0.0b2 | 
examples-pse-2.0.0b2 | FileNotFoundError: Error occured when trying to read the ALAMO trace file - this probably indicates that a trace file was not created by the ALAMO executable. Please check the ALAMO output logs.
examples-pse-2.0.0b2 | FileNotFoundError: Error occured when trying to read the ALAMO trace file - this probably indicates that a trace file was not created by the ALAMO executable. Please check the ALAMO output logs.
examples-pse-2.0.0b2 | 
examples-pse-2.0.0b2 | 2022-12-07 19:12:02,647 ERROR - [Worker 0] Execution failed: generating partial output for '/home/runner/examples-pse/src/Examples/SurrMod/FlowsheetOptimization/ALAMO_flowsheet_optimization.ipynb'
examples-pse-2.0.0b2 | 2022-12-07 19:12:02,647 INFO - [Worker 0] Convert notebook name=/home/runner/examples-pse/src/Examples/SurrMod/FlowsheetOptimization/ALAMO_flowsheet_optimization.ipynb: end, ok=False duration=3.5s

Update examples toward IDAES v2

We can use this issue to keep track of the modifications that we'll need to apply to the examples to track the various changes introduced toward IDAES v2, updating it appropriately when a new IDAES v2 PR is created.

Example structure (the content is likely wrong):

build.py errors for Python 3.6 on Windows

This error came up by running the tests from this repo as part of the IDAES/idaes-pse integration tests. Here's the error log:

============================= test session starts =============================
platform win32 -- Python 3.6.8, pytest-6.1.2, py-1.9.0, pluggy-0.13.1
rootdir: D:\a\idaes-pse\idaes-pse\examples-pse, configfile: pytest.ini
plugins: cov-2.10.1
collected 1 item / 2 errors

=================================== ERRORS ====================================
_________________ ERROR collecting tests/test_build_script.py _________________
tests\test_build_script.py:18: in <module>
    import build
build.py:120: in <module>
    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
E   AttributeError: module 'asyncio' has no attribute 'WindowsSelectorEventLoopPolicy'
------------------------------- Captured stdout -------------------------------
path: ['D:\\a\\idaes-pse\\idaes-pse\\examples-pse', 'D:\\a\\idaes-pse\\idaes-pse\\examples-pse\\tests', 'C:\\hostedtoolcache\\windows\\Python\\3.6.8\\x64\\Scripts\\pytest.exe', 'c:\\hostedtoolcache\\windows\\python\\3.6.8\\x64\\python36.zip', 'c:\\hostedtoolcache\\windows\\python\\3.6.8\\x64\\DLLs', 'c:\\hostedtoolcache\\windows\\python\\3.6.8\\x64\\lib', 'c:\\hostedtoolcache\\windows\\python\\3.6.8\\x64', 'c:\\hostedtoolcache\\windows\\python\\3.6.8\\x64\\lib\\site-packages', 'c:\\hostedtoolcache\\windows\\python\\3.6.8\\x64\\lib\\site-packages\\win32', 'c:\\hostedtoolcache\\windows\\python\\3.6.8\\x64\\lib\\site-packages\\win32\\lib', 'c:\\hostedtoolcache\\windows\\python\\3.6.8\\x64\\lib\\site-packages\\Pythonwin']
__________________ ERROR collecting tests/test_notebooks.py ___________________
tests\test_notebooks.py:17: in <module>
    import build
build.py:120: in <module>
    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
E   AttributeError: module 'asyncio' has no attribute 'WindowsSelectorEventLoopPolicy'

. It seems to be limited to the specific combination Python 3.6 and Windows, and wasn't caught by the tests here in examples-pse because the CI is not running on the full Python version and OS test matrix just yet (which will be rectified ASAP).

I think the fix shouldn't be too hard, essentially just add a special case within the special case in build.py#L117-120.

Fix broken links in top-level notebook_index.ipynb

Noticed that almost all links to tutorials and examples seem to be broken in our notebook_index.ipynb. The following work:

  • data_management_framework
  • Pysmo_basics
  • ALAMO_six_hump
  • air_separation_case_study

MatOpt example jupyter notebooks' output error

Hi, we have noticed that there are errors in the outputs of MatOpt example notebooks. For example, in the output below In[11] in https://idaes.github.io/examples-pse/latest/Examples/MatOpt/monometallic_nanocluster_design_doc.html, it says that the size of the model exceeds the community version's CPLEX' limitation. However, in the source file https://github.com/IDAES/examples-pse/blob/main/src/Examples/MatOpt/monometallic_nanocluster_design.ipynb, the same version of community CPLEX solves the problem successfully and shows no error in the output. Does the website-generation mechanism ignores the original output and tries to generate new outputs on the fly? If so, is it possible that previous version notebooks were used? If the issue arises from CPLEX further reducing the size limitation, we could modify the source files to reduce the size of the examples further or to use NEOS-CPLEX (if the website-generation mechanism supports internet access). Thank you.

Failures for CI jobs on Windows with Python 3.8 due to error: DLL load failed while importing win32api: The specified module could not be found.

The error

Possible causes

Next steps

  • As the usual fix doesn't seem to work, this will require additional investigation, most likely on a separate PR
  • In the meantime, if the CI checks for all other OS/Python version combination are passing for a PR, it's probably safe to assume that the notebooks themselves are OK and thus the failing check can be ignored

Check solver statistics in tests

The idea originates in the #81 discussion.

Specifically, we want to check the number of iterations.

Code from @andrewlee94:

from pyomo.contrib.parmest.ipopt_solver_wrapper import ipopt_solve_with_stats

Notebook build fails with "Failed due to error: 'ParallelNotebookWorker' object has no attribute 's'" on timeout

I believe this is caused when catching the TimeoutException here: trying to access self.s results in an AttributeError since ParallelNotebookWorker does not set this attribute, possibly because it doesn't inherit from the Builder base class EDIT (ParallelNotebookWorker is used internally by NotebookBuilder, so the inheritance remark probably doesn't apply).

This occurred when running notebooks as part of the integration checks for IDAES/idaes-pse#249, but I think could happen whenever a TimeoutError is thrown in a ParallelNotebookWorker, which I assume happens when a notebook's runtime exceeds a certain threshold.

I could work on a quick fix once @dangunter chimes in on what would be the best way for ParallelNotebookWorker instances to set/initialize s.

Released examples 2.0.0a3 do not work with IDAES main

The most recent released examples are not up to date with changes in IDAES 2.0.0a3 and therefore have incorrect imports (e.g. generic_models instead of models) and arguments (use of default=). This is based only on looking at the HDA flowsheet in Tutorials/Basics, but it probably holds true for other examples as well. The code in main seems correct.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.