diff --git a/idaes/core/util/model_diagnostics.py b/idaes/core/util/model_diagnostics.py index 4b5b783b56..2185ffda7c 100644 --- a/idaes/core/util/model_diagnostics.py +++ b/idaes/core/util/model_diagnostics.py @@ -1753,7 +1753,12 @@ def report_structural_issues(self, stream=None): # Potential evaluation errors # TODO: High Index? + if len(greybox_block_set(self._model)) != 0: + raise NotImplementedError( + "Model contains Greybox models, which are not supported by Diagnostics toolbox at the moment" + ) stats = _collect_model_statistics(self._model) + warnings, next_steps = self._collect_structural_warnings() cautions = self._collect_structural_cautions() @@ -1797,6 +1802,10 @@ def report_numerical_issues(self, stream=None): """ if stream is None: stream = sys.stdout + if len(greybox_block_set(self._model)) != 0: + raise NotImplementedError( + "Model contains Greybox models, which are not supported by Diagnostics toolbox at the moment" + ) jac, nlp = get_jacobian(self._model, scaled=False) diff --git a/idaes/core/util/model_statistics.py b/idaes/core/util/model_statistics.py index 92b54fbaed..db0c6481b1 100644 --- a/idaes/core/util/model_statistics.py +++ b/idaes/core/util/model_statistics.py @@ -287,7 +287,7 @@ def total_constraints_set(block): def number_total_constraints(block): """ Method to return the total number of Constraint components in a model. - This will include constraints provided by Greybox models using + This will include number of constraints provided by Greybox models using number_activated_greybox_equalities function. Args: @@ -425,7 +425,7 @@ def total_equalities_set(block): def number_total_equalities(block): """ Method to return the total number of equality Constraint components in a - model. This will include number of activated equalities using number_activated_greybox_equalities function. + model. This will include number of activated equalities Greybox using number_activated_greybox_equalities function. Args: block : model to be studied @@ -571,7 +571,7 @@ def deactivated_equalities_set(block): def number_deactivated_equalities(block): """ Method to return the number of deactivated equality Constraint components - in a model. This include number of deactivated equality constraints in Greybox models. + in a model. This will include number of deactivated equality constraints in Greybox models. Args: block : model to be studied @@ -1216,7 +1216,7 @@ def unfixed_greybox_variables(block): block : model to be studied Returns: - A ComponentSet of unfixed Var components which appear in Greybox models + A ComponentSet of all unfixed Var components which appear in Greybox models """ var_set = ComponentSet() for var in greybox_variables(block): @@ -1233,8 +1233,8 @@ def greybox_variables(block): block : model to be studied Returns: - A ComponentSet including all unfixed Var components which appear within - activated equality Constraints in block + A ComponentSet of all Var components which appear within + activated Greybox model blocks """ var_set = ComponentSet() for grey_box in activated_greybox_block_set(block): @@ -1346,7 +1346,7 @@ def number_unused_variables(block): block : model to be studied Returns: - Number of Var components which do not appear within any activagted + Number of Var components which do not appear within any activated Constraints in block """ return len(unused_variables_set(block))