Skip to content

Commit

Permalink
bug fix: catch AttributeError in set_scaling_from_default (#1400)
Browse files Browse the repository at this point in the history
Co-authored-by: Ludovico Bianchi <lbianchi@lbl.gov>
  • Loading branch information
jasonmbray-p66 and lbianchi-lbl authored Apr 25, 2024
1 parent b3d55b7 commit 5cf975f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions idaes/core/util/scaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1179,9 +1179,15 @@ def set_scaling_from_default(
return

parent = component.parent_block()
dsf = parent.get_default_scaling(
component.parent_component().local_name, index=component.index()
)
try:
dsf = parent.get_default_scaling(
component.parent_component().local_name, index=component.index()
)
except AttributeError:
dsf = None
_log.warning(
f"{component.name} block missing 'get_default_scaling()' method, no scaling factor assigned."
)

if dsf is not None:
set_scaling_factor(component, dsf, overwrite=overwrite)
Expand Down

0 comments on commit 5cf975f

Please sign in to comment.