Model Diagnostic Functions

The IDAES toolset contains a number of utility functions which can be useful for identifying modeling issues and debugging solver issues.

Other Methods

This module contains a collection of tools for diagnosing modeling issues.

idaes.core.util.model_diagnostics.get_valid_range_of_component(component)[source]

Return the valid range for a component as specified in the model metadata.

Parameters

component – Pyomo component to get valid range for

Returns

valid range for component if found. This will either be a 2-tuple (low, high) or None.

Raises

AttributeError if metadata object not found

idaes.core.util.model_diagnostics.ipopt_solve_halt_on_error(model, options=None)[source]

Run IPOPT to solve model with debugging output enabled.

This function calls IPOPT to solve the model provided with settings to halt on AMPL evaluation errors and report these with symbolic names.

Parameters
  • model – Pyomo model to be solved.

  • options – solver options to be passed to IPOPT

Returns

Pyomo solver results dict

idaes.core.util.model_diagnostics.list_components_with_values_outside_valid_range(component, descend_into=True)[source]

Return a list of component objects with values outside the valid range specified in the model metadata.

This function will iterate over component data objects in Blocks and indexed components.

Parameters
  • component – Pyomo component to search for component outside of range on. This can be a Block, Var or Param.

  • descend_into – (optional) Whether to descend into components on child Blocks (default=True)

Returns

list of component objects found with values outside the valid range.

idaes.core.util.model_diagnostics.set_bounds_from_valid_range(component, descend_into=True)[source]

Set bounds on Pyomo components based on valid range recorded in model metadata. WARNING - this function will overwrite any bounds already set on the component/model.

This function will iterate over component data objects in Blocks and indexed components.

Parameters
  • component – Pyomo component to set bounds on. This can be a Block, Var or Param.

  • descend_into – (optional) Whether to descend into components on child Blocks (default=True)

Returns

None