Constraint Term Analysis#
The Constraint Term Analysis tool provides utility functions for analyzing and diagnosing issues related to constraint terms in a model.
- class idaes.core.util.diagnostics_tools.constraint_term_analysis.ConstraintTermAnalysisVisitor(term_mismatch_tolerance=1000000.0, term_cancellation_tolerance=0.0001, term_zero_tolerance=1e-10, max_canceling_terms=4, max_cancellations_per_node=5)[source]#
Expression walker for checking Constraints for problematic terms.
This walker will walk the expression and look for summation terms with mismatched magnitudes or potential cancellations.
- Parameters:
term_mismatch_tolerance (float) – tolerance to use when determining mismatched terms
term_cancellation_tolerance (float) – tolerance to use when identifying possible cancellation of terms
term_zero_tolerance (float) – tolerance for considering terms equal to zero
max_canceling_terms (int) – maximum number of terms to consider when looking for canceling combinations (None = consider all possible combinations)
max_cancellations_per_node (int) – maximum number of cancellations to collect for a single node. Collection will terminate when this many cancellations have been identified (None = collect all cancellations)
- Returns:
list of values for top-level summation terms list of terms with mismatched magnitudes list of terms with potential cancellations bool indicating whether expression is a constant
- walk_expression(expr)[source]#
Main method to call to walk an expression and return analysis.
- Parameters:
analyzed (expr - expression to be)
- Returns:
list of values of top-level additive terms ComponentSet containing any mismatched terms ComponentSet containing any canceling terms Bool indicating whether expression is a constant